The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Other
8.01k
stars
1.65k
forks
source link
websocket_client and json::value are oil and water on Windows #1349
websocket_client allows you to receive message bodies as streams of uint8_t or as std::strings, which are both utf-8 (also, per specification, the only valid encoding for JSON is utf-8)
json::value::parse allows you to pass utility::string_t or utility::istream_t, which on Windows are typedef'd to wstring and basic_stream<wchar_t> (wistream) and therefore utf-16 (also, per specification, the only valid encoding for JSON is utf-8)
Without jumping through hoops, it is practically impossible to receive a message from a websocket client and parse it as JSON.
websocket_client
allows you to receive message bodies as streams of uint8_t or asstd::string
s, which are both utf-8 (also, per specification, the only valid encoding for JSON is utf-8)json::value::parse
allows you to passutility::string_t
orutility::istream_t
, which on Windows are typedef'd towstring
andbasic_stream<wchar_t>
(wistream
) and therefore utf-16 (also, per specification, the only valid encoding for JSON is utf-8)Without jumping through hoops, it is practically impossible to receive a message from a websocket client and parse it as JSON.