Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does websocket of this lib support windows 7 #635

Open
developernew123 opened this issue Dec 20, 2017 · 7 comments
Open

Does websocket of this lib support windows 7 #635

developernew123 opened this issue Dec 20, 2017 · 7 comments

Comments

@developernew123
Copy link

Does websocket of this lib support windows 7 as very many users still use windows 7

@garethsb
Copy link
Contributor

Yes.

@developernew123
Copy link
Author

ok , and is there any errors on windows 10 as I tried a simple c++ websocket lib it was good although it hadn't a message handler but I didn't need this feature
the problem is that it worked well on windows 7 and 8 but on windows 10 I got an error in cmd :
Error : url size limit reached then the program crashes , I wish this doesn't happen with this library

@garethsb
Copy link
Contributor

C++ REST SDK enables implementing websocket clients, see https://github.com/Microsoft/cpprestsdk/wiki/Web-Socket. There's an open issue to add support for implementing websocket server, see #358.

The current C++ REST SDK cross-platform Web Socket code is built on top of the Websocket++ open source library.

@developernew123
Copy link
Author

developernew123 commented Dec 20, 2017

I tried to use it after building statically but I still nedd a dll file and the program crashes when I try to connect to the server

I'm trying to connect to chrome remote debugger on port 4789 so I launch chrome with the needed args then send curl request to localhost:port/json to get ws urls of the pages to connect to them

for example I got this :
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:4789/devtools/page/(155CF001CDD9DB93AEADF79728040F11)",
"faviconUrl": "https://www.google.com.eg/favicon.ico",
"id": "(155CF001CDD9DB93AEADF79728040F11)",
"title": "علامة تبويب جديدة",
"type": "page",
"url": "chrome://newtab/",
"webSocketDebuggerUrl": "ws://localhost:4789/devtools/page/(155CF001CDD9DB93AEADF79728040F11)"
} ]
I get "ws://localhost:4789/devtools/page/(155CF001CDD9DB93AEADF79728040F11)" and try to connect to it like this :

// I set it string as I recieved and parsed the response from curl as std::string

string url = "urlintext"; TCHAR *wsurl = new wchar_t[wsurl.size()]; MultiByteToWideChar(CP_ACP, 0, url.c_str(), -1, wsurl, url.size()); // connect function doesn't accept anscii websocket_client client; client.connect(wsurl).then([]() {wcout << "connected to chrome" << endl; });;

the program crashes on connecting and the debugger take me to ppltasks.h line 750 which is :
_REPORT_PPLTASK_UNOBSERVED_EXCEPTION();

I want to get rid of this crash and build full statically without any dll

@developernew123
Copy link
Author

I put it in try catch statement and I got this :

UTF-16 string is missing low surrogate

@garethsb
Copy link
Contributor

That exception comes from UTF-16 to UTF-8 conversion and indicates invalid UTF-16 data. I suggest you put a breakpoint at https://github.com/Microsoft/cpprestsdk/blob/v2.10.1/Release/src/utilities/asyncrt_utils.cpp#L429 and debug where the invalid data is coming from during the connection process.

@garethsb
Copy link
Contributor

By the way, rather than using std::string and MultiByteToWideChar directly, why not use the facilities of C++ REST SDK, e.g. utility::string_t, utility::conversions::to_string_t(), and the U() macro?

websocket_client client;
client.connect(U("ws://..."));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants