diff --git a/CHANGELOG/index.html b/CHANGELOG/index.html
index 0271e355..49af10ec 100644
--- a/CHANGELOG/index.html
+++ b/CHANGELOG/index.html
@@ -92,6 +92,10 @@
Changelog
+ - [11.4.5] - 2024-06-05
+
+
- [11.4.4] - 2023-06-05
@@ -1205,6 +1209,8 @@
Changelog
All changes to this project will be documented in this file.
+[11.4.5] - 2024-06-05
+New changes are documented in the Release page in the GitHub repository.
[11.4.4] - 2023-06-05
[11.4.3] - 2022-05-13
Set shorter thread names
diff --git a/index.html b/index.html
index bf1955e2..d56672c1 100644
--- a/index.html
+++ b/index.html
@@ -371,5 +371,5 @@
Keyboard Shortcuts
diff --git a/search/search_index.json b/search/search_index.json
index 44123ddb..235dc029 100644
--- a/search/search_index.json
+++ b/search/search_index.json
@@ -1 +1 @@
-{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing. It is been used on big mobile video game titles sending and receiving tons of messages since 2017 (iOS and Android). It was tested on macOS, iOS, Linux, Android, Windows and FreeBSD. Note that the MinGW compiler is not supported at this point. Two important design goals are simplicity and correctness. A bad security bug affecting users compiling with SSL enabled and OpenSSL as the backend was just fixed in newly released version 11.0.0. Please upgrade ! (more details in the https://github.com/machinezone/IXWebSocket/pull/250 . /* * main.cpp * Author: Benjamin Sergeant * Copyright (c) 2020 Machine Zone, Inc. All rights reserved. * * Super simple standalone example. See ws folder, unittest and doc/usage.md for more. * * On macOS * $ mkdir -p build ; (cd build ; cmake -DUSE_TLS=1 .. ; make -j ; make install) * $ clang++ --std=c++11 --stdlib=libc++ main.cpp -lixwebsocket -lz -framework Security -framework Foundation * $ ./a.out * * Or use cmake -DBUILD_DEMO=ON option for other platforms */ #include #include #include #include int main() { // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; // Connect to a server with encryption // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url(\"wss://echo.websocket.org\"); webSocket.setUrl(url); std::cout << \"Connecting to \" << url << \"...\" << std::endl; // Setup a callback to be fired (in a background thread, watch out for race conditions !) // when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << \"received message: \" << msg->str << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"Connection established\" << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Error) { // Maybe SSL is not configured properly std::cout << \"Connection error: \" << msg->errorInfo.reason << std::endl; std::cout << \"> \" << std::flush; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // Display a prompt std::cout << \"> \" << std::flush; std::string text; // Read text from the console and send messages in text mode. // Exit with Ctrl-D on Unix or Ctrl-Z on Windows. while (std::getline(std::cin, text)) { webSocket.send(text); std::cout << \"> \" << std::flush; } return 0; } Interested? Go read the docs ! If things don't work as expected, please create an issue on GitHub, or even better a pull request if you know how to fix your problem. IXWebSocket is actively being developed, check out the changelog to know what's cooking. If you are looking for a real time messaging service (the chat-like 'server' your websocket code will talk to) with many features such as history, backed by Redis, look at cobra . IXWebSocket client code is autobahn compliant beginning with the 6.0.0 version. See the current test results . Some tests are still failing in the server code. Starting with the 11.0.8 release, IXWebSocket should be fully C++11 compatible. Users If your company or project is using this library, feel free to open an issue or PR to amend this list. Machine Zone Tokio , a discord library focused on audio playback with node bindings. libDiscordBot , an easy to use Discord-bot framework. gwebsocket , a websocket (lua) module for Garry's Mod DisCPP , a simple but feature rich Discord API wrapper discord.cpp , a discord library for making bots Teleport , Teleport is your own personal remote robot avatar Alternative libraries There are plenty of great websocket libraries out there, which might work for you. Here are a couple of serious ones. websocketpp - C++ beast - C++ libwebsockets - C \u00b5WebSockets - C wslay - C uvweb is a library written by the IXWebSocket author which is built on top of uvw , which is a C++ wrapper for libuv . It has more dependencies and does not support SSL at this point, but it can be used to open multiple connections within a single OS thread thanks to libuv. To check the performance of a websocket library, you can look at the autoroute project. Continuous Integration OS TLS Sanitizer Status Linux OpenSSL None macOS Secure Transport Thread Sanitizer macOS OpenSSL Thread Sanitizer macOS MbedTLS Thread Sanitizer Windows Disabled None UWP Disabled None Linux OpenSSL Address Sanitizer Mingw Disabled None ASAN fails on Linux because of a known problem, we need a Some tests are disabled on Windows/UWP because of a pathing problem TLS and ZLIB are disabled on Windows/UWP because enabling make the CI run takes a lot of time, for setting up vcpkg.","title":"Home"},{"location":"#hello-world","text":"IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing. It is been used on big mobile video game titles sending and receiving tons of messages since 2017 (iOS and Android). It was tested on macOS, iOS, Linux, Android, Windows and FreeBSD. Note that the MinGW compiler is not supported at this point. Two important design goals are simplicity and correctness. A bad security bug affecting users compiling with SSL enabled and OpenSSL as the backend was just fixed in newly released version 11.0.0. Please upgrade ! (more details in the https://github.com/machinezone/IXWebSocket/pull/250 . /* * main.cpp * Author: Benjamin Sergeant * Copyright (c) 2020 Machine Zone, Inc. All rights reserved. * * Super simple standalone example. See ws folder, unittest and doc/usage.md for more. * * On macOS * $ mkdir -p build ; (cd build ; cmake -DUSE_TLS=1 .. ; make -j ; make install) * $ clang++ --std=c++11 --stdlib=libc++ main.cpp -lixwebsocket -lz -framework Security -framework Foundation * $ ./a.out * * Or use cmake -DBUILD_DEMO=ON option for other platforms */ #include #include #include #include int main() { // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; // Connect to a server with encryption // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url(\"wss://echo.websocket.org\"); webSocket.setUrl(url); std::cout << \"Connecting to \" << url << \"...\" << std::endl; // Setup a callback to be fired (in a background thread, watch out for race conditions !) // when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << \"received message: \" << msg->str << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"Connection established\" << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Error) { // Maybe SSL is not configured properly std::cout << \"Connection error: \" << msg->errorInfo.reason << std::endl; std::cout << \"> \" << std::flush; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // Display a prompt std::cout << \"> \" << std::flush; std::string text; // Read text from the console and send messages in text mode. // Exit with Ctrl-D on Unix or Ctrl-Z on Windows. while (std::getline(std::cin, text)) { webSocket.send(text); std::cout << \"> \" << std::flush; } return 0; } Interested? Go read the docs ! If things don't work as expected, please create an issue on GitHub, or even better a pull request if you know how to fix your problem. IXWebSocket is actively being developed, check out the changelog to know what's cooking. If you are looking for a real time messaging service (the chat-like 'server' your websocket code will talk to) with many features such as history, backed by Redis, look at cobra . IXWebSocket client code is autobahn compliant beginning with the 6.0.0 version. See the current test results . Some tests are still failing in the server code. Starting with the 11.0.8 release, IXWebSocket should be fully C++11 compatible.","title":"Hello world"},{"location":"#users","text":"If your company or project is using this library, feel free to open an issue or PR to amend this list. Machine Zone Tokio , a discord library focused on audio playback with node bindings. libDiscordBot , an easy to use Discord-bot framework. gwebsocket , a websocket (lua) module for Garry's Mod DisCPP , a simple but feature rich Discord API wrapper discord.cpp , a discord library for making bots Teleport , Teleport is your own personal remote robot avatar","title":"Users"},{"location":"#alternative-libraries","text":"There are plenty of great websocket libraries out there, which might work for you. Here are a couple of serious ones. websocketpp - C++ beast - C++ libwebsockets - C \u00b5WebSockets - C wslay - C uvweb is a library written by the IXWebSocket author which is built on top of uvw , which is a C++ wrapper for libuv . It has more dependencies and does not support SSL at this point, but it can be used to open multiple connections within a single OS thread thanks to libuv. To check the performance of a websocket library, you can look at the autoroute project.","title":"Alternative libraries"},{"location":"#continuous-integration","text":"OS TLS Sanitizer Status Linux OpenSSL None macOS Secure Transport Thread Sanitizer macOS OpenSSL Thread Sanitizer macOS MbedTLS Thread Sanitizer Windows Disabled None UWP Disabled None Linux OpenSSL Address Sanitizer Mingw Disabled None ASAN fails on Linux because of a known problem, we need a Some tests are disabled on Windows/UWP because of a pathing problem TLS and ZLIB are disabled on Windows/UWP because enabling make the CI run takes a lot of time, for setting up vcpkg.","title":"Continuous Integration"},{"location":"CHANGELOG/","text":"Changelog All changes to this project will be documented in this file. [11.4.4] - 2023-06-05 [11.4.3] - 2022-05-13 Set shorter thread names BoringSSL fix with SNI Websocket computed header is valid Base64 [11.4.1] - 2022-04-23 vckpg + cmake fix, to handle zlib as a dependency better [11.4.0] - 2022-01-05 (Windows) Use wsa select event, which should lead to a much better behavior on Windows in general, and also when sending large payloads (#342) Fix \"HTTP/1.1 400 Illegal character CNTL=0xf\" caused by serverMaxWindowBits/clientMaxWindowBits being uint8_t (signed char). (#341) Export symbols into .def files Export symbols into .def files on MSVC (#339) Include to provide standard error constants (#338) Improved compatibility - fix mingw crossbuild (#337) Allow to cancel asynchronous HTTP requests (#332) Fix errors in example code. (#336) [11.3.2] - 2021-11-24 (server) Add getters for basic Servers properties (like port, host, etc...) (#327) + fix one compiler warning [11.3.1] - 2021-10-22 (library/cmake) Compatible with MbedTLS 3 + fix a bug on Windows where the incorrect remote port is computed (#320) [11.3.0] - 2021-09-20 (library/cmake) Only find OpenSSL, MbedTLS, zlib if they have not already been found, make CMake install optional (#317) + Use GNUInstallDirs in cmake (#318) [11.2.10] - 2021-07-27 (ws) bump CLI command line parsing library from 1.8 to 2.0 [11.2.9] - 2021-06-08 (ws) ws connect has a -g option to gzip decompress messages for API such as the websocket Huobi Global. [11.2.8] - 2021-06-03 (websocket client + server) WebSocketMessage class tweak to fix unsafe patterns [11.2.7] - 2021-05-27 (websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade) [11.2.6] - 2021-05-18 (Windows) move EINVAL (re)definition from IXSocket.h to IXNetSystem.h (fix #289) [11.2.5] - 2021-04-04 (http client) DEL is not an HTTP method name, but DELETE is [11.2.4] - 2021-03-25 (cmake) install IXUniquePtr.h [11.2.3] - 2021-03-24 (ssl + windows) missing include for CertOpenStore function [11.2.2] - 2021-03-23 (ixwebsocket) version bump [11.2.1] - 2021-03-23 (ixwebsocket) version bump [11.2.0] - 2021-03-23 (ixwebsocket) correct mingw support (gcc on windows) [11.1.4] - 2021-03-23 (ixwebsocket) add getMinWaitBetweenReconnectionRetries [11.1.3] - 2021-03-23 (ixwebsocket) New option to set the min wait between reconnection attempts. Still default to 1ms. (setMinWaitBetweenReconnectionRetries). [11.1.2] - 2021-03-22 (ws) initialize maxWaitBetweenReconnectionRetries to a non zero value ; a zero value was causing spurious reconnections attempts [11.1.1] - 2021-03-20 (cmake) Library can be built as a static or a dynamic library, controlled with BUILD_SHARED_LIBS. Default to static library [11.1.0] - 2021-03-16 (ixwebsocket) Use LEAN_AND_MEAN Windows define to help with undefined link error when building a DLL. Support websocket server disablePerMessageDeflate option correctly. [11.0.9] - 2021-03-07 (ixwebsocket) Expose setHandshakeTimeout method [11.0.8] - 2020-12-25 (ws) trim ws dependencies no more ixcrypto and ixcore deps [11.0.7] - 2020-12-25 (ws) trim ws dependencies, only depends on ixcrypto and ixcore [11.0.6] - 2020-12-22 (build) rename makefile to makefile.dev to ease cmake BuildExternal (fix #261) [11.0.5] - 2020-12-17 (ws) Implement simple header based websocket authorization technique to reject client which do not supply a certain header (\"Authorization\") with a special value (see doc). [11.0.4] - 2020-11-16 (ixwebsocket) Handle EINTR return code in ix::poll and IXSelectInterrupt [11.0.3] - 2020-11-16 (ixwebsocket) Fix #252 / regression in 11.0.2 with string comparisons [11.0.2] - 2020-11-15 (ixwebsocket) use a C++11 compatible make_unique shim [11.0.1] - 2020-11-11 (socket) replace a std::vector with an std::array used as a tmp buffer in Socket::readBytes [11.0.0] - 2020-11-11 (openssl security fix) in the client to server connection, peer verification is not done in all cases. See https://github.com/machinezone/IXWebSocket/pull/250 [10.5.7] - 2020-11-07 (docker) build docker container with zlib disabled [10.5.6] - 2020-11-07 (cmake) DEFLATE -> Deflate in CMake to stop warnings about casing [10.5.5] - 2020-11-07 (ws autoroute) Display result in compliant way (AUTOROUTE IXWebSocket :: N ms) so that result can be parsed easily [10.5.4] - 2020-10-30 (ws gunzip + IXGZipCodec) Can decompress gziped data with libdeflate. ws gunzip computed output filename was incorrect (was the extension aka gz) instead of the file without the extension. Also check whether the output file is writeable. [10.5.3] - 2020-10-19 (http code) With zlib disabled, some code should not be reached [10.5.2] - 2020-10-12 (ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb [10.5.1] - 2020-10-09 (http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present. [10.5.0] - 2020-09-30 (http client + server + ws) Add support for uploading files with ws -F foo=@filename, new -D http server option to debug incoming client requests, internal api changed for http POST, PUT and PATCH to supply an HttpFormDataParameters [10.4.9] - 2020-09-30 (http server + utility code) Add support for doing gzip compression with libdeflate library, if available [10.4.8] - 2020-09-30 (cmake) Stop using FetchContent cmake module to retrieve jsoncpp third party dependency [10.4.7] - 2020-09-28 (ws) add gzip and gunzip ws sub commands [10.4.6] - 2020-09-26 (cmake) use FetchContent cmake module to retrieve jsoncpp third party dependency [10.4.5] - 2020-09-26 (cmake) use FetchContent cmake module to retrieve spdlog third party dependency [10.4.4] - 2020-09-22 (cobra connection) retrieve cobra server connection id from the cobra handshake message and display it in ws clients, metrics publisher and bots [10.4.3] - 2020-09-22 (cobra 2 cobra) specify as an HTTP header which channel we will republish to [10.4.2] - 2020-09-18 (cobra bots) change an error log to a warning log when reconnecting because no messages were received for a minute [10.4.1] - 2020-09-18 (cobra connection and bots) set an HTTP header when connecting to help with debugging bots [10.4.0] - 2020-09-12 (http server) read body request when the Content-Length is specified + set timeout to read the request to 30 seconds max by default, and make it configurable as a constructor parameter [10.3.5] - 2020-09-09 (ws) autoroute command exit on its own once all messages have been received [10.3.4] - 2020-09-04 (docker) ws docker file installs strace [10.3.3] - 2020-09-02 (ws) echo_client command renamed to autoroute. Command exit once the server close the connection. push_server commands exit once N messages have been sent. [10.3.2] - 2020-08-31 (ws + cobra bots) add a cobra_to_cobra ws subcommand to subscribe to a channel and republish received events to a different channel [10.3.1] - 2020-08-28 (socket servers) merge the ConnectionInfo class with the ConnectionState one, which simplify all the server apis [10.3.0] - 2020-08-26 (ws) set the main thread name, to help with debugging in XCode, gdb, lldb etc... [10.2.9] - 2020-08-19 (ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py [10.2.8] - 2020-08-19 (ws) on Linux with mbedtls, when the system ca certs are specified (the default) pick up sensible OS supplied paths (tested with CentOS and Alpine) [10.2.7] - 2020-08-18 (ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected [10.2.6] - 2020-08-17 (ixwebsocket) replace std::unique_ptr with std::array for some fixed arrays (which are in C++11) [10.2.5] - 2020-08-15 (ws) merge all ws_*.cpp files into a single one to speedup compilation [10.2.4] - 2020-08-15 (socket server) in the loop accepting connections, call select without a timeout on unix to avoid busy looping, and only wake up when a new connection happens [10.2.3] - 2020-08-15 (socket server) instead of busy looping with a sleep, only wake up the GC thread when a new thread will have to be joined, (we know that thanks to the ConnectionState OnSetTerminated callback [10.2.2] - 2020-08-15 (socket server) add a callback to the ConnectionState to be invoked when the connection is terminated. This will be used by the SocketServer in the future to know on time that the associated connection thread can be terminated. [10.2.1] - 2020-08-15 (socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable [10.2.0] - 2020-08-14 (ixwebsocket client) handle HTTP redirects [10.2.0] - 2020-08-13 (ws) upgrade to latest version of nlohmann json (3.9.1 from 3.2.0) [10.1.9] - 2020-08-13 (websocket proxy server) add ability to map different hosts to different websocket servers, using a json config file [10.1.8] - 2020-08-12 (ws) on macOS, with OpenSSL or MbedTLS, use /etc/ssl/cert.pem as the system certs [10.1.7] - 2020-08-11 (ws) -q option imply info log level, not warning log level [10.1.6] - 2020-08-06 (websocket server) Handle programmer error when the server callback is not registered properly (fix #227) [10.1.5] - 2020-08-02 (ws) Add a new ws sub-command, push_server. This command runs a server which sends many messages in a loop to a websocket client. We can receive above 200,000 messages per second (cf #235). [10.1.4] - 2020-08-02 (ws) Add a new ws sub-command, echo_client. This command sends a message to an echo server, and send back to a server whatever message it does receive. When connecting to a local ws echo_server, on my MacBook Pro 2015 I can send/receive around 30,000 messages per second. (cf #235) [10.1.3] - 2020-08-02 (ws) ws echo_server. Add a -q option to only enable warning and error log levels. This is useful for bench-marking so that we do not print a lot of things on the console. (cf #235) [10.1.2] - 2020-07-31 (build) make using zlib optional, with the caveat that some http and websocket features are not available when zlib is absent [10.1.1] - 2020-07-29 (websocket client) onProgressCallback not called for short messages on a websocket (fix #233) [10.1.0] - 2020-07-29 (websocket client) heartbeat is not sent at the requested frequency (fix #232) [10.0.3] - 2020-07-28 compiler warning fixes [10.0.2] - 2020-07-28 (ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting [10.0.1] - 2020-07-27 (socket utility) move ix::getFreePort to ixwebsocket library [10.0.0] - 2020-07-25 (ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr as its first argument [9.10.7] - 2020-07-25 (ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better. [9.10.6] - 2020-07-24 (ws) port broadcast_server sub-command to the new server API [9.10.5] - 2020-07-24 (unittest) port most unittests to the new server API [9.10.3] - 2020-07-24 (ws) port ws transfer to the new server API [9.10.2] - 2020-07-24 (websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor [9.10.1] - 2020-07-24 (websocket server) reset client websocket callback when the connection is closed [9.10.0] - 2020-07-23 (websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did [9.9.3] - 2020-07-17 (build) merge platform specific files which were used to have different implementations for setting a thread name into a single file, to make it easier to include every source files and build the ixwebsocket library (fix #226) [9.9.2] - 2020-07-10 (socket server) bump default max connection count from 32 to 128 [9.9.1] - 2020-07-10 (snake) implement super simple stream sql expression support in snake server [9.9.0] - 2020-07-08 (socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made [9.8.6] - 2020-07-06 (cmake) change the way zlib and openssl are searched [9.8.5] - 2020-07-06 (cobra python bots) remove the test which stop the bot when events do not follow cobra metrics system schema with an id and a device entry [9.8.4] - 2020-06-26 (cobra bots) remove bots which is not required now that we can use Python extensions [9.8.3] - 2020-06-25 (cmake) new python code is optional and enabled at cmake time with -DUSE_PYTHON=1 [9.8.2] - 2020-06-24 (cobra bots) new cobra metrics bot to send data to statsd using Python for processing the message [9.8.1] - 2020-06-19 (cobra metrics to statsd bot) fps slow frame info : do not include os name [9.8.0] - 2020-06-19 (cobra metrics to statsd bot) send info about memory warnings [9.7.9] - 2020-06-18 (http client) fix deadlock when following redirects [9.7.8] - 2020-06-18 (cobra metrics to statsd bot) send info about net requests [9.7.7] - 2020-06-17 (cobra client and bots) add batch_size subscription option for retrieving multiple messages at once [9.7.6] - 2020-06-15 (websocket) WebSocketServer is not a final class, so that users can extend it (fix #215) [9.7.5] - 2020-06-15 (cobra bots) minor aesthetic change, in how we display http headers with a : then space as key value separator instead of :: with no space [9.7.4] - 2020-06-11 (cobra metrics to statsd bot) change from a statsd type of gauge to a timing one [9.7.3] - 2020-06-11 (redis cobra bots) capture most used devices in a zset [9.7.2] - 2020-06-11 (ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise [9.7.1] - 2020-06-11 (redis cobra bots) ws cobra metrics to redis / hostname invalid parsing [9.7.0] - 2020-06-11 (redis cobra bots) xadd with maxlen + fix bug in xadd client implementation and ws cobra metrics to redis command argument parsing [9.6.9] - 2020-06-10 (redis cobra bots) update the cobra to redis bot to use the bot framework, and change it to report fps metrics into redis streams. [9.6.6] - 2020-06-04 (statsd cobra bots) statsd improvement: prefix does not need a dot as a suffix, message size can be larger than 256 bytes, error handling was invalid, use core logger for logging instead of std::cerr [9.6.5] - 2020-05-29 (http server) support gzip compression [9.6.4] - 2020-05-20 (compiler fix) support clang 5 and earlier (contributed by @LunarWatcher) [9.6.3] - 2020-05-18 (cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL [9.6.2] - 2020-05-17 (cmake) make install cmake files optional to not conflict with vcpkg [9.6.1] - 2020-05-17 (windows + tls) mbedtls is the default windows tls backend + add ability to load system certificates with mbdetls on windows [9.6.0] - 2020-05-12 (ixbots) add options to limit how many messages per minute should be processed [9.5.9] - 2020-05-12 (ixbots) add new class to configure a bot to simplify passing options around [9.5.8] - 2020-05-08 (openssl tls) (openssl < 1.1) logic inversion - crypto locking callback are not registered properly [9.5.7] - 2020-05-08 (cmake) default TLS back to mbedtls on Windows Universal Platform [9.5.6] - 2020-05-06 (cobra bots) add a --heartbeat_timeout option to specify when the bot should terminate because no events are received [9.5.5] - 2020-05-06 (openssl tls) when OpenSSL is older than 1.1, register the crypto locking callback to be thread safe. Should fix lots of CI failures [9.5.4] - 2020-05-04 (cobra bots) do not use a queue to store messages pending processing, let the bot handle queuing [9.5.3] - 2020-04-29 (http client) better current request cancellation support when the HttpClient destructor is invoked (see #189) [9.5.2] - 2020-04-27 (cmake) fix cmake broken tls option parsing [9.5.1] - 2020-04-27 (http client) Set default values for most HttpRequestArgs struct members (fix #185) [9.5.0] - 2020-04-25 (ssl) Default to OpenSSL on Windows, since it can load the system certificates by default [9.4.1] - 2020-04-25 (header) Add a space between header name and header value since most http parsers expects it, although it it not required. Cf #184 and #155 [9.4.0] - 2020-04-24 (ssl) Add support for supplying SSL CA from memory, for OpenSSL and MbedTLS backends [9.3.3] - 2020-04-17 (ixbots) display sent/receive message, per seconds as accumulated [9.3.2] - 2020-04-17 (ws) add a --logfile option to configure all logs to go to a file [9.3.1] - 2020-04-16 (cobra bots) add a utility class to factor out the common bots features (heartbeat) and move all bots to used it + convert cobra_subscribe to be a bot and add a unittest for it [9.3.0] - 2020-04-15 (websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent [9.2.9] - 2020-04-15 (ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible [9.2.8] - 2020-04-15 (ixcobra) make CobraConnection_EventType an enum class (CobraEventType) [9.2.7] - 2020-04-14 (ixsentry) add a library method to upload a payload directly to sentry [9.2.6] - 2020-04-14 (ixcobra) snake server / handle invalid incoming json messages + cobra subscriber in fluentd mode insert a created_at timestamp entry [9.2.5] - 2020-04-13 (websocket) WebSocketMessagePtr is a unique_ptr instead of a shared_ptr [9.2.4] - 2020-04-13 (websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations [9.2.3] - 2020-04-13 (ws) add a --runtime option to ws cobra_subscribe to optionally limit how much time it will run [9.2.2] - 2020-04-04 (third_party deps) fix #177, update bundled spdlog to 1.6.0 [9.2.1] - 2020-04-04 (windows) when using OpenSSL, the system store is used to populate the cacert. No need to ship a cacert.pem file with your app. [9.2.0] - 2020-04-04 (windows) ci: windows build with TLS (mbedtls) + verify that we can be build with OpenSSL [9.1.9] - 2020-03-30 (cobra to statsd bot) add ability to extract a numerical value and send a timer event to statsd, with the --timer option [9.1.8] - 2020-03-29 (cobra to statsd bot) bot init was missing + capture socket error [9.1.7] - 2020-03-29 (cobra to statsd bot) add ability to extract a numerical value and send a gauge event to statsd, with the --gauge option [9.1.6] - 2020-03-29 (ws cobra subscriber) use a Json::StreamWriter to write to std::cout, and save one std::string allocation for each message printed [9.1.5] - 2020-03-29 (docker) trim down docker image (300M -> 12M) / binary built without symbol and size optimization, and source code not copied over [9.1.4] - 2020-03-28 (jsoncpp) update bundled copy to version 1.9.3 (at sha 3beb37ea14aec1bdce1a6d542dc464d00f4a6cec) [9.1.3] - 2020-03-27 (docker) alpine docker build with release with debug info, and bundle ca-certificates [9.1.2] - 2020-03-26 (mac ssl) rename DarwinSSL -> SecureTransport (see this too -> https://github.com/curl/curl/issues/3733) [9.1.1] - 2020-03-26 (websocket) fix data race accessing _socket object without mutex protection when calling wakeUpFromPoll in WebSocketTransport.cpp [9.1.0] - 2020-03-26 (ixcobra) add explicit event types for handshake, authentication and subscription failure, and handle those by exiting in ws_cobra_subcribe and friends [9.0.3] - 2020-03-24 (ws connect) display statistics about how much time it takes to stop the connection [9.0.2] - 2020-03-24 (socket) works with unique_ptr instead of shared_ptr in many places [9.0.1] - 2020-03-24 (socket) selectInterrupt member is an unique_ptr instead of being a shared_ptr [9.0.0] - 2020-03-23 (websocket) reset per-message deflate codec everytime we connect to a server/client [8.3.4] - 2020-03-23 (websocket) fix #167, a long standing issue with sending empty messages with per-message deflate extension (and hopefully other zlib bug) [8.3.3] - 2020-03-22 (cobra to statsd) port to windows and add a unittest [8.3.2] - 2020-03-20 (websocket+tls) fix hang in tls handshake which could lead to ANR, discovered through unittesting. [8.3.1] - 2020-03-20 (cobra) CobraMetricsPublisher can be configure with an ix::CobraConfig + more unittest use SSL in server + client [8.3.0] - 2020-03-18 (websocket) Simplify ping/pong based heartbeat implementation [8.2.7] - 2020-03-17 (ws) ws connect gains a new option to set the interval at which to send pings (ws) ws echo_server gains a new option (-p) to disable responding to pings with pongs IXWebSocket$ ws connect --ping_interval 2 wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected [2020-03-17 23:53:02.726] [info] Uri: / [2020-03-17 23:53:02.726] [info] Headers: [2020-03-17 23:53:02.727] [info] Connection: Upgrade [2020-03-17 23:53:02.727] [info] Date: Wed, 18 Mar 2020 06:45:05 GMT [2020-03-17 23:53:02.727] [info] Sec-WebSocket-Accept: 0gtqbxW0aVL/QI/ICpLFnRaiKgA= [2020-03-17 23:53:02.727] [info] sec-websocket-extensions: [2020-03-17 23:53:02.727] [info] Server: Kaazing Gateway [2020-03-17 23:53:02.727] [info] Upgrade: websocket [2020-03-17 23:53:04.894] [info] Received pong [2020-03-17 23:53:06.859] [info] Received pong [2020-03-17 23:53:08.881] [info] Received pong [2020-03-17 23:53:10.848] [info] Received pong [2020-03-17 23:53:12.898] [info] Received pong [2020-03-17 23:53:14.865] [info] Received pong [2020-03-17 23:53:16.890] [info] Received pong [2020-03-17 23:53:18.853] [info] Received pong [2020-03-17 23:53:19.388] [info] ws_connect: connection closed: code 1000 reason Normal closure [2020-03-17 23:53:19.502] [info] Received 208 bytes [2020-03-17 23:53:19.502] [info] Sent 0 bytes [8.2.6] - 2020-03-16 (cobra to sentry bot + docker) default docker file uses mbedtls + ws cobra_to_sentry pass tls options to sentryClient. [8.2.5] - 2020-03-13 (cobra client) ws cobra subscribe resubscribe at latest position after being disconnected [8.2.4] - 2020-03-13 (cobra client) can subscribe with a position [8.2.3] - 2020-03-13 (cobra client) pass the message position to the subscription data callback [8.2.2] - 2020-03-12 (openssl tls backend) Fix a hand in OpenSSL when using TLS v1.3 ... by disabling TLS v1.3 [8.2.1] - 2020-03-11 (cobra) IXCobraConfig struct has tlsOptions and per message deflate options [8.2.0] - 2020-03-11 (cobra) add IXCobraConfig struct to pass cobra config around [8.1.9] - 2020-03-09 (ws cobra_subscribe) add a --fluentd option to wrap a message in an enveloppe so that fluentd can recognize it [8.1.8] - 2020-03-02 (websocket server) fix regression with disabling zlib extension on the server side. If a client does not support this extension the server will handle it fine. We still need to figure out how to disable the option. [8.1.7] - 2020-02-26 (websocket) traffic tracker received bytes is message size while it should be wire size [8.1.6] - 2020-02-26 (ws_connect) display sent/received bytes statistics on exit [8.1.5] - 2020-02-23 (server) give thread name to some usual worker threads / unittest is broken !! [8.1.4] - 2020-02-22 (websocket server) fix regression from 8.1.2, where per-deflate message compression was always disabled [8.1.3] - 2020-02-21 (client + server) Fix #155 / http header parser should treat the space(s) after the : delimiter as optional. Fixing this bug made us discover that websocket sub-protocols are not properly serialiazed, but start with a , [8.1.2] - 2020-02-18 (WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server [8.1.1] - 2020-02-18 (ws cobra to statsd and sentry sender) exit if no messages are received for one minute, which is a sign that something goes wrong on the server side. That should be changed to be configurable in the future [8.1.0] - 2020-02-13 (http client + sentry minidump upload) Multipart stream closing boundary is invalid + mark some options as mandatory in the command line tools [8.0.7] - 2020-02-12 (build) remove the unused subtree which was causing some way of installing to break [8.0.6] - 2020-01-31 (snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections [8.0.5] - 2020-01-31 (IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection [8.0.4] - 2020-01-31 (cobra to sentry) remove noisy logging [8.0.3] - 2020-01-30 (ixcobra) check if we are authenticated in publishNext before trying to publish a message [8.0.2] - 2020-01-28 Extract severity level when emitting messages to sentry [8.0.1] - 2020-01-28 Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry [8.0.0] - 2020-01-26 (SocketServer) add ability to bind on an ipv6 address [7.9.6] - 2020-01-22 (ws) add a dnslookup sub-command, to get the ip address of a remote host [7.9.5] - 2020-01-14 (windows) fix #144, get rid of stubbed/un-implemented windows schannel ssl backend [7.9.4] - 2020-01-12 (openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl [7.9.3] - 2020-01-10 (apple ssl) model write method after the OpenSSL one for consistency [7.9.2] - 2020-01-06 (apple ssl) unify read and write ssl utility code [7.9.1] - 2020-01-06 (websocket client) better error propagation when errors are detected while sending data (ws send) detect failures to send big files, terminate in those cases and report error [7.9.0] - 2020-01-04 (ws send) add option (-x) to disable per message deflate compression [7.8.9] - 2020-01-04 (ws send + receive) handle all message types (ping + pong + fragment) / investigate #140 [7.8.8] - 2019-12-28 (mbedtls) fix related to private key file parsing and initialization [7.8.6] - 2019-12-28 (ws cobra to sentry/statsd) fix for handling null events properly for empty queues + use queue to send data to statsd [7.8.5] - 2019-12-28 (ws cobra to sentry) handle null events for empty queues [7.8.4] - 2019-12-27 (ws cobra to sentry) game is picked in a fair manner, so that all games get the same share of sent events [7.8.3] - 2019-12-27 (ws cobra to sentry) refactor queue related code into a class [7.8.2] - 2019-12-25 (ws cobra to sentry) bound the queue size used to hold up cobra messages before they are sent to sentry. Default queue size is a 100 messages. Without such limit the program runs out of memory when a subscriber receive a lot of messages that cannot make it to sentry [7.8.1] - 2019-12-25 (ws client) use correct compilation defines so that spdlog is not used as a header only library (reduce binary size and increase compilation speed) [7.8.0] - 2019-12-24 (ws client) all commands use spdlog instead of std::cerr or std::cout for logging [7.6.5] - 2019-12-24 (cobra client) send a websocket ping every 30s to keep the connection opened [7.6.4] - 2019-12-22 (client) error handling, quote url in error case when failing to parse one (ws) ws_cobra_publish: register callbacks before connecting (doc) mention mbedtls in supported ssl server backend [7.6.3] - 2019-12-20 (tls) add a simple description of the TLS configuration routine for debugging [7.6.2] - 2019-12-20 (mbedtls) correct support for using own certificate and private key [7.6.1] - 2019-12-20 (ws commands) in websocket proxy, disable automatic reconnections + in Dockerfile, use alpine 3.11 [7.6.0] - 2019-12-19 (cobra) Add TLS options to all cobra commands and classes. Add example to the doc. [7.5.8] - 2019-12-18 (cobra-to-sentry) capture application version from device field [7.5.7] - 2019-12-18 (tls) Experimental TLS server support with mbedtls (windows) + process cert tlsoption (client + server) [7.5.6] - 2019-12-18 (tls servers) Make it clear that apple ssl and mbedtls backends do not support SSL in server mode [7.5.5] - 2019-12-17 (tls options client) TLSOptions struct _validated member should be initialized to false [7.5.4] - 2019-12-16 (websocket client) improve the error message when connecting to a non websocket server Before: Connection error: Got bad status connecting to example.com:443, status: 200, HTTP Status line: HTTP/1.1 200 OK After: Connection error: Expecting status 101 (Switching Protocol), got 200 status connecting to example.com:443, HTTP Status line: HTTP/1.1 200 OK [7.5.3] - 2019-12-12 (server) attempt at fixing #131 by using blocking writes in server mode [7.5.2] - 2019-12-11 (ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages [7.5.1] - 2019-12-06 (mac) convert SSL errors to utf8 [7.5.0] - 2019-12-05 (ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry. In the example below sentry we are sending data too fast, sentry asks us to slow down which we do. Notice how the sent count stop increasing, while we are waiting for 41 seconds. [2019-12-05 15:50:33.759] [info] messages received 2449 sent 3 [2019-12-05 15:50:34.759] [info] messages received 5533 sent 7 [2019-12-05 15:50:35.759] [info] messages received 8612 sent 11 [2019-12-05 15:50:36.759] [info] messages received 11562 sent 15 [2019-12-05 15:50:37.759] [info] messages received 14410 sent 19 [2019-12-05 15:50:38.759] [info] messages received 17236 sent 23 [2019-12-05 15:50:39.282] [error] Error sending data to sentry: 429 [2019-12-05 15:50:39.282] [error] Body: {\"exception\":[{\"stacktrace\":{\"frames\":[{\"filename\":\"WorldScene.lua\",\"function\":\"WorldScene.lua:1935\",\"lineno\":1958},{\"filename\":\"WorldScene.lua\",\"function\":\"onUpdate_WorldCam\",\"lineno\":1921},{\"filename\":\"WorldMapTile.lua\",\"function\":\"__index\",\"lineno\":239}]},\"value\":\"noisytypes: Attempt to call nil(nil,2224139838)!\"}],\"platform\":\"python\",\"sdk\":{\"name\":\"ws\",\"version\":\"1.0.0\"},\"tags\":[[\"game\",\"niso\"],[\"userid\",\"107638363\"],[\"environment\",\"live\"]],\"timestamp\":\"2019-12-05T23:50:39Z\"} [2019-12-05 15:50:39.282] [error] Response: {\"error_name\":\"rate_limit\",\"error\":\"Creation of this event was denied due to rate limiting\"} [2019-12-05 15:50:39.282] [warning] Error 429 - Too Many Requests. ws will sleep and retry after 41 seconds [2019-12-05 15:50:39.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:40.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:41.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:42.761] [info] messages received 18839 sent 25 [2019-12-05 15:50:43.762] [info] messages received 18839 sent 25 [2019-12-05 15:50:44.763] [info] messages received 18839 sent 25 [2019-12-05 15:50:45.768] [info] messages received 18839 sent 25 [7.4.5] - 2019-12-03 (ws) #125 / fix build problem when jsoncpp is not installed locally [7.4.4] - 2019-12-03 (ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present [7.4.3] - 2019-12-03 (http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases [7.4.2] - 2019-12-02 (client) internal IXDNSLookup class requires a valid cancellation request function callback to be passed in [7.4.1] - 2019-12-02 (client) fix an overflow in the exponential back off code [7.4.0] - 2019-11-25 (http client) Add support for multipart HTTP POST upload (ixsentry) Add support for uploading a minidump to sentry [7.3.5] - 2019-11-20 On Darwin SSL, add ability to skip peer verification. [7.3.4] - 2019-11-20 32-bits compile fix, courtesy of @fcojavmc [7.3.1] - 2019-11-16 ws proxy_server / remote server close not forwarded to the client [7.3.0] - 2019-11-15 New ws command: ws proxy_server . [7.2.2] - 2019-11-01 Tag a release + minor reformating. [7.2.1] - 2019-10-26 Add unittest to IXSentryClient to lua backtrace parsing code [7.2.0] - 2019-10-24 Add cobra_metrics_to_redis sub-command to create streams for each cobra metric event being received. [7.1.0] - 2019-10-13 Add client support for websocket subprotocol. Look for the new addSubProtocol method for details. [7.0.0] - 2019-10-01 TLS support in server code, only implemented for the OpenSSL SSL backend for now. [6.3.4] - 2019-09-30 all ws subcommands propagate tls options to servers (unimplemented) or ws or http client (implemented) (contributed by Matt DeBoer) [6.3.3] - 2019-09-30 ws has a --version option [6.3.2] - 2019-09-29 (http + websocket clients) can specify cacert and some other tls options (not implemented on all backend). This makes it so that server certs can finally be validated on windows. [6.3.1] - 2019-09-29 Add ability to use OpenSSL on apple platforms. [6.3.0] - 2019-09-28 ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher [6.2.9] - 2019-09-27 mbedtls fixes / the unittest now pass on macOS, and hopefully will on Windows/AppVeyor as well. [6.2.8] - 2019-09-26 Http server: add options to ws https to redirect all requests to a given url. POST requests will get a 200 and an empty response. ws httpd -L --redirect_url https://www.google.com [6.2.7] - 2019-09-25 Stop having ws send subcommand send a binary message in text mode, which would cause error in make ws_test shell script test. [6.2.6] - 2019-09-24 Fix 2 race conditions detected with TSan, one in CobraMetricsPublisher::push and another one in WebSocketTransport::sendData (that one was bad). [6.2.5] - 2019-09-23 Add simple Redis Server which is only capable of doing publish / subscribe. New ws redis_server sub-command to use it. The server is used in the unittest, so that we can run on CI in environment where redis isn not available like github actions env. [6.2.4] - 2019-09-22 Add options to configure TLS ; contributed by Matt DeBoer. Only implemented for OpenSSL TLS backend for now. [6.2.3] - 2019-09-21 Fix crash in the Linux unittest in the HTTP client code, in Socket::readBytes Cobra Metrics Publisher code returns the message id of the message that got published, to be used to validated that it got sent properly when receiving an ack. [6.2.2] - 2019-09-19 In DNS lookup code, make sure the weak pointer we use lives through the expected scope (if branch) [6.2.1] - 2019-09-17 On error while doing a client handshake, additionally display port number next to the host name [6.2.0] - 2019-09-09 websocket and http server: server does not close the bound client socket in many cases improve some websocket error messages add a utility function with unittest to parse status line and stop using scanf which triggers warnings on Windows update ws CLI11 (our command line argument parsing library) to the latest, which fix a compiler bug about optional [6.1.0] - 2019-09-08 move poll wrapper on top of select (only used on Windows) to the ix namespace [6.0.1] - 2019-09-05 add cobra metrics publisher + server unittest add cobra client + server unittest ws snake (cobra simple server) add basic support for unsubscription + subscribe send the proper subscription data + redis client subscription can be cancelled IXCobraConnection / pdu handlers can crash if they receive json data which is not an object [6.0.0] - 2019-09-04 all client autobahn test should pass ! zlib/deflate has a bug with windowsbits == 8, so we silently upgrade it to 9/ (fix autobahn test 13.X which uses 8 for the windows size) [5.2.0] - 2019-09-04 Fragmentation: for sent messages which are compressed, the continuation fragments should not have the rsv1 bit set (fix all autobahn tests for zlib compression 12.X) Websocket Server / do a case insensitive string search when looking for an Upgrade header whose value is websocket. (some client use WebSocket with some upper-case characters) [5.1.9] - 2019-09-03 ws autobahn / report progress with spdlog::info to get timing info ws autobahn / use condition variables for stopping test case + add more logging on errors [5.1.8] - 2019-09-03 Per message deflate/compression: handle fragmented messages (fix autobahn test: 12.1.X and probably others) [5.1.7] - 2019-09-03 Receiving invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) [5.1.6] - 2019-09-03 Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead. Validate that the reason is proper utf-8. (fix autobahn test 7.5.1) Validate close codes. Autobahn 7.9.* [5.1.5] - 2019-09-03 Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation) [5.1.4] - 2019-09-03 Sending invalid UTF-8 TEXT message should fail and close the connection (fix tons of autobahn test: 6.X UTF-8 Handling) [5.1.3] - 2019-09-03 Message type (TEXT or BINARY) is invalid for received fragmented messages (fix autobahn test: 5.3 through 5.8 Fragmentation) [5.1.2] - 2019-09-02 Ping and Pong messages cannot be fragmented (fix autobahn test: 5.1 and 5.2 Fragmentation) [5.1.1] - 2019-09-01 Close connections when reserved bits are used (fix autobahn test: 3.X Reserved Bits) [5.1.0] - 2019-08-31 ws autobahn / Add code to test websocket client compliance with the autobahn test-suite add utf-8 validation code, not hooked up properly yet Ping received with a payload too large (> 125 bytes) trigger a connection closure cobra / add tracking about published messages cobra / publish returns a message id, that can be used when cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system). [5.0.9] - 2019-08-30 User-Agent header is set when not specified. New option to cap the max wait between reconnection attempts. Still default to 10s. (setMaxWaitBetweenReconnectionRetries). ws connect --max_wait 5000 ws://example.com # will only wait 5 seconds max between reconnection attempts [5.0.7] - 2019-08-23 WebSocket: add new option to pass in extra HTTP headers when connecting. ws connect add new option (-H, works like curl ) to pass in extra HTTP headers when connecting If you run against ws echo_server you will see the headers being received printed in the terminal. ws connect -H \"foo: bar\" -H \"baz: buz\" ws://127.0.0.1:8008 CobraConnection: sets a unique id field for all messages sent to cobra . CobraConnection: sets a counter as a field for each event published. [5.0.6] - 2019-08-22 Windows: silly compile error (poll should be in the global namespace) [5.0.5] - 2019-08-22 Windows: use select instead of WSAPoll, through a poll wrapper [5.0.4] - 2019-08-20 Windows build fixes (there was a problem with the use of ::poll that has a different name on Windows (WSAPoll)) [5.0.3] - 2019-08-14 CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default [5.0.2] - 2019-08-01 ws cobra_subscribe has a new -q (quiet) option ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) ws cobra_subscribe, cobra_to_statsd and cobra_to_sentry commands have a new option, --filter to restrict the events they want to receive [5.0.1] - 2019-07-25 ws connect command has a new option to send in binary mode (still default to text) ws connect command has readline history thanks to libnoise-cpp. Now ws connect one can use using arrows to lookup previous sent messages and edit them [5.0.0] - 2019-06-23 Changed New HTTP server / still very early. ws gained a new command, httpd can run a simple webserver serving local files. IXDNSLookup. Uses weak pointer + smart_ptr + shared_from_this instead of static sets + mutex to handle object going away before dns lookup has resolved cobra_to_sentry / backtraces are reversed and line number is not extracted correctly mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found travis CI uses g++ on Linux [4.0.0] - 2019-06-09 Changed WebSocket::send() sends message in TEXT mode by default WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text WebSocket::send takes a third arg, binary which default to true (can be text too) WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg Add explicit WebSocket::sendBinary method New headers + WebSocketMessage class to hold message data, still not used across the board Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility. ws echo_server has a -g option to print a greeting message on connect IXSocketMbedTLS: better error handling in close and connect [3.1.2] - 2019-06-06 Added ws connect has a -x option to disable per message deflate Add WebSocket::disablePerMessageDeflate() option. [3.0.0] - 2019-06-xx Changed TLS, aka SSL works on Windows (websocket and http clients) ws command line tool build on Windows Async API for HttpClient HttpClient API changed to use shared_ptr for response and request","title":"Changelog"},{"location":"CHANGELOG/#changelog","text":"All changes to this project will be documented in this file.","title":"Changelog"},{"location":"CHANGELOG/#1144-2023-06-05","text":"","title":"[11.4.4] - 2023-06-05"},{"location":"CHANGELOG/#1143-2022-05-13","text":"Set shorter thread names BoringSSL fix with SNI Websocket computed header is valid Base64","title":"[11.4.3] - 2022-05-13"},{"location":"CHANGELOG/#1141-2022-04-23","text":"vckpg + cmake fix, to handle zlib as a dependency better","title":"[11.4.1] - 2022-04-23"},{"location":"CHANGELOG/#1140-2022-01-05","text":"(Windows) Use wsa select event, which should lead to a much better behavior on Windows in general, and also when sending large payloads (#342) Fix \"HTTP/1.1 400 Illegal character CNTL=0xf\" caused by serverMaxWindowBits/clientMaxWindowBits being uint8_t (signed char). (#341) Export symbols into .def files Export symbols into .def files on MSVC (#339) Include to provide standard error constants (#338) Improved compatibility - fix mingw crossbuild (#337) Allow to cancel asynchronous HTTP requests (#332) Fix errors in example code. (#336)","title":"[11.4.0] - 2022-01-05"},{"location":"CHANGELOG/#1132-2021-11-24","text":"(server) Add getters for basic Servers properties (like port, host, etc...) (#327) + fix one compiler warning","title":"[11.3.2] - 2021-11-24"},{"location":"CHANGELOG/#1131-2021-10-22","text":"(library/cmake) Compatible with MbedTLS 3 + fix a bug on Windows where the incorrect remote port is computed (#320)","title":"[11.3.1] - 2021-10-22"},{"location":"CHANGELOG/#1130-2021-09-20","text":"(library/cmake) Only find OpenSSL, MbedTLS, zlib if they have not already been found, make CMake install optional (#317) + Use GNUInstallDirs in cmake (#318)","title":"[11.3.0] - 2021-09-20"},{"location":"CHANGELOG/#11210-2021-07-27","text":"(ws) bump CLI command line parsing library from 1.8 to 2.0","title":"[11.2.10] - 2021-07-27"},{"location":"CHANGELOG/#1129-2021-06-08","text":"(ws) ws connect has a -g option to gzip decompress messages for API such as the websocket Huobi Global.","title":"[11.2.9] - 2021-06-08"},{"location":"CHANGELOG/#1128-2021-06-03","text":"(websocket client + server) WebSocketMessage class tweak to fix unsafe patterns","title":"[11.2.8] - 2021-06-03"},{"location":"CHANGELOG/#1127-2021-05-27","text":"(websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade)","title":"[11.2.7] - 2021-05-27"},{"location":"CHANGELOG/#1126-2021-05-18","text":"(Windows) move EINVAL (re)definition from IXSocket.h to IXNetSystem.h (fix #289)","title":"[11.2.6] - 2021-05-18"},{"location":"CHANGELOG/#1125-2021-04-04","text":"(http client) DEL is not an HTTP method name, but DELETE is","title":"[11.2.5] - 2021-04-04"},{"location":"CHANGELOG/#1124-2021-03-25","text":"(cmake) install IXUniquePtr.h","title":"[11.2.4] - 2021-03-25"},{"location":"CHANGELOG/#1123-2021-03-24","text":"(ssl + windows) missing include for CertOpenStore function","title":"[11.2.3] - 2021-03-24"},{"location":"CHANGELOG/#1122-2021-03-23","text":"(ixwebsocket) version bump","title":"[11.2.2] - 2021-03-23"},{"location":"CHANGELOG/#1121-2021-03-23","text":"(ixwebsocket) version bump","title":"[11.2.1] - 2021-03-23"},{"location":"CHANGELOG/#1120-2021-03-23","text":"(ixwebsocket) correct mingw support (gcc on windows)","title":"[11.2.0] - 2021-03-23"},{"location":"CHANGELOG/#1114-2021-03-23","text":"(ixwebsocket) add getMinWaitBetweenReconnectionRetries","title":"[11.1.4] - 2021-03-23"},{"location":"CHANGELOG/#1113-2021-03-23","text":"(ixwebsocket) New option to set the min wait between reconnection attempts. Still default to 1ms. (setMinWaitBetweenReconnectionRetries).","title":"[11.1.3] - 2021-03-23"},{"location":"CHANGELOG/#1112-2021-03-22","text":"(ws) initialize maxWaitBetweenReconnectionRetries to a non zero value ; a zero value was causing spurious reconnections attempts","title":"[11.1.2] - 2021-03-22"},{"location":"CHANGELOG/#1111-2021-03-20","text":"(cmake) Library can be built as a static or a dynamic library, controlled with BUILD_SHARED_LIBS. Default to static library","title":"[11.1.1] - 2021-03-20"},{"location":"CHANGELOG/#1110-2021-03-16","text":"(ixwebsocket) Use LEAN_AND_MEAN Windows define to help with undefined link error when building a DLL. Support websocket server disablePerMessageDeflate option correctly.","title":"[11.1.0] - 2021-03-16"},{"location":"CHANGELOG/#1109-2021-03-07","text":"(ixwebsocket) Expose setHandshakeTimeout method","title":"[11.0.9] - 2021-03-07"},{"location":"CHANGELOG/#1108-2020-12-25","text":"(ws) trim ws dependencies no more ixcrypto and ixcore deps","title":"[11.0.8] - 2020-12-25"},{"location":"CHANGELOG/#1107-2020-12-25","text":"(ws) trim ws dependencies, only depends on ixcrypto and ixcore","title":"[11.0.7] - 2020-12-25"},{"location":"CHANGELOG/#1106-2020-12-22","text":"(build) rename makefile to makefile.dev to ease cmake BuildExternal (fix #261)","title":"[11.0.6] - 2020-12-22"},{"location":"CHANGELOG/#1105-2020-12-17","text":"(ws) Implement simple header based websocket authorization technique to reject client which do not supply a certain header (\"Authorization\") with a special value (see doc).","title":"[11.0.5] - 2020-12-17"},{"location":"CHANGELOG/#1104-2020-11-16","text":"(ixwebsocket) Handle EINTR return code in ix::poll and IXSelectInterrupt","title":"[11.0.4] - 2020-11-16"},{"location":"CHANGELOG/#1103-2020-11-16","text":"(ixwebsocket) Fix #252 / regression in 11.0.2 with string comparisons","title":"[11.0.3] - 2020-11-16"},{"location":"CHANGELOG/#1102-2020-11-15","text":"(ixwebsocket) use a C++11 compatible make_unique shim","title":"[11.0.2] - 2020-11-15"},{"location":"CHANGELOG/#1101-2020-11-11","text":"(socket) replace a std::vector with an std::array used as a tmp buffer in Socket::readBytes","title":"[11.0.1] - 2020-11-11"},{"location":"CHANGELOG/#1100-2020-11-11","text":"(openssl security fix) in the client to server connection, peer verification is not done in all cases. See https://github.com/machinezone/IXWebSocket/pull/250","title":"[11.0.0] - 2020-11-11"},{"location":"CHANGELOG/#1057-2020-11-07","text":"(docker) build docker container with zlib disabled","title":"[10.5.7] - 2020-11-07"},{"location":"CHANGELOG/#1056-2020-11-07","text":"(cmake) DEFLATE -> Deflate in CMake to stop warnings about casing","title":"[10.5.6] - 2020-11-07"},{"location":"CHANGELOG/#1055-2020-11-07","text":"(ws autoroute) Display result in compliant way (AUTOROUTE IXWebSocket :: N ms) so that result can be parsed easily","title":"[10.5.5] - 2020-11-07"},{"location":"CHANGELOG/#1054-2020-10-30","text":"(ws gunzip + IXGZipCodec) Can decompress gziped data with libdeflate. ws gunzip computed output filename was incorrect (was the extension aka gz) instead of the file without the extension. Also check whether the output file is writeable.","title":"[10.5.4] - 2020-10-30"},{"location":"CHANGELOG/#1053-2020-10-19","text":"(http code) With zlib disabled, some code should not be reached","title":"[10.5.3] - 2020-10-19"},{"location":"CHANGELOG/#1052-2020-10-12","text":"(ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb","title":"[10.5.2] - 2020-10-12"},{"location":"CHANGELOG/#1051-2020-10-09","text":"(http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present.","title":"[10.5.1] - 2020-10-09"},{"location":"CHANGELOG/#1050-2020-09-30","text":"(http client + server + ws) Add support for uploading files with ws -F foo=@filename, new -D http server option to debug incoming client requests, internal api changed for http POST, PUT and PATCH to supply an HttpFormDataParameters","title":"[10.5.0] - 2020-09-30"},{"location":"CHANGELOG/#1049-2020-09-30","text":"(http server + utility code) Add support for doing gzip compression with libdeflate library, if available","title":"[10.4.9] - 2020-09-30"},{"location":"CHANGELOG/#1048-2020-09-30","text":"(cmake) Stop using FetchContent cmake module to retrieve jsoncpp third party dependency","title":"[10.4.8] - 2020-09-30"},{"location":"CHANGELOG/#1047-2020-09-28","text":"(ws) add gzip and gunzip ws sub commands","title":"[10.4.7] - 2020-09-28"},{"location":"CHANGELOG/#1046-2020-09-26","text":"(cmake) use FetchContent cmake module to retrieve jsoncpp third party dependency","title":"[10.4.6] - 2020-09-26"},{"location":"CHANGELOG/#1045-2020-09-26","text":"(cmake) use FetchContent cmake module to retrieve spdlog third party dependency","title":"[10.4.5] - 2020-09-26"},{"location":"CHANGELOG/#1044-2020-09-22","text":"(cobra connection) retrieve cobra server connection id from the cobra handshake message and display it in ws clients, metrics publisher and bots","title":"[10.4.4] - 2020-09-22"},{"location":"CHANGELOG/#1043-2020-09-22","text":"(cobra 2 cobra) specify as an HTTP header which channel we will republish to","title":"[10.4.3] - 2020-09-22"},{"location":"CHANGELOG/#1042-2020-09-18","text":"(cobra bots) change an error log to a warning log when reconnecting because no messages were received for a minute","title":"[10.4.2] - 2020-09-18"},{"location":"CHANGELOG/#1041-2020-09-18","text":"(cobra connection and bots) set an HTTP header when connecting to help with debugging bots","title":"[10.4.1] - 2020-09-18"},{"location":"CHANGELOG/#1040-2020-09-12","text":"(http server) read body request when the Content-Length is specified + set timeout to read the request to 30 seconds max by default, and make it configurable as a constructor parameter","title":"[10.4.0] - 2020-09-12"},{"location":"CHANGELOG/#1035-2020-09-09","text":"(ws) autoroute command exit on its own once all messages have been received","title":"[10.3.5] - 2020-09-09"},{"location":"CHANGELOG/#1034-2020-09-04","text":"(docker) ws docker file installs strace","title":"[10.3.4] - 2020-09-04"},{"location":"CHANGELOG/#1033-2020-09-02","text":"(ws) echo_client command renamed to autoroute. Command exit once the server close the connection. push_server commands exit once N messages have been sent.","title":"[10.3.3] - 2020-09-02"},{"location":"CHANGELOG/#1032-2020-08-31","text":"(ws + cobra bots) add a cobra_to_cobra ws subcommand to subscribe to a channel and republish received events to a different channel","title":"[10.3.2] - 2020-08-31"},{"location":"CHANGELOG/#1031-2020-08-28","text":"(socket servers) merge the ConnectionInfo class with the ConnectionState one, which simplify all the server apis","title":"[10.3.1] - 2020-08-28"},{"location":"CHANGELOG/#1030-2020-08-26","text":"(ws) set the main thread name, to help with debugging in XCode, gdb, lldb etc...","title":"[10.3.0] - 2020-08-26"},{"location":"CHANGELOG/#1029-2020-08-19","text":"(ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py","title":"[10.2.9] - 2020-08-19"},{"location":"CHANGELOG/#1028-2020-08-19","text":"(ws) on Linux with mbedtls, when the system ca certs are specified (the default) pick up sensible OS supplied paths (tested with CentOS and Alpine)","title":"[10.2.8] - 2020-08-19"},{"location":"CHANGELOG/#1027-2020-08-18","text":"(ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected","title":"[10.2.7] - 2020-08-18"},{"location":"CHANGELOG/#1026-2020-08-17","text":"(ixwebsocket) replace std::unique_ptr with std::array for some fixed arrays (which are in C++11)","title":"[10.2.6] - 2020-08-17"},{"location":"CHANGELOG/#1025-2020-08-15","text":"(ws) merge all ws_*.cpp files into a single one to speedup compilation","title":"[10.2.5] - 2020-08-15"},{"location":"CHANGELOG/#1024-2020-08-15","text":"(socket server) in the loop accepting connections, call select without a timeout on unix to avoid busy looping, and only wake up when a new connection happens","title":"[10.2.4] - 2020-08-15"},{"location":"CHANGELOG/#1023-2020-08-15","text":"(socket server) instead of busy looping with a sleep, only wake up the GC thread when a new thread will have to be joined, (we know that thanks to the ConnectionState OnSetTerminated callback","title":"[10.2.3] - 2020-08-15"},{"location":"CHANGELOG/#1022-2020-08-15","text":"(socket server) add a callback to the ConnectionState to be invoked when the connection is terminated. This will be used by the SocketServer in the future to know on time that the associated connection thread can be terminated.","title":"[10.2.2] - 2020-08-15"},{"location":"CHANGELOG/#1021-2020-08-15","text":"(socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable","title":"[10.2.1] - 2020-08-15"},{"location":"CHANGELOG/#1020-2020-08-14","text":"(ixwebsocket client) handle HTTP redirects","title":"[10.2.0] - 2020-08-14"},{"location":"CHANGELOG/#1020-2020-08-13","text":"(ws) upgrade to latest version of nlohmann json (3.9.1 from 3.2.0)","title":"[10.2.0] - 2020-08-13"},{"location":"CHANGELOG/#1019-2020-08-13","text":"(websocket proxy server) add ability to map different hosts to different websocket servers, using a json config file","title":"[10.1.9] - 2020-08-13"},{"location":"CHANGELOG/#1018-2020-08-12","text":"(ws) on macOS, with OpenSSL or MbedTLS, use /etc/ssl/cert.pem as the system certs","title":"[10.1.8] - 2020-08-12"},{"location":"CHANGELOG/#1017-2020-08-11","text":"(ws) -q option imply info log level, not warning log level","title":"[10.1.7] - 2020-08-11"},{"location":"CHANGELOG/#1016-2020-08-06","text":"(websocket server) Handle programmer error when the server callback is not registered properly (fix #227)","title":"[10.1.6] - 2020-08-06"},{"location":"CHANGELOG/#1015-2020-08-02","text":"(ws) Add a new ws sub-command, push_server. This command runs a server which sends many messages in a loop to a websocket client. We can receive above 200,000 messages per second (cf #235).","title":"[10.1.5] - 2020-08-02"},{"location":"CHANGELOG/#1014-2020-08-02","text":"(ws) Add a new ws sub-command, echo_client. This command sends a message to an echo server, and send back to a server whatever message it does receive. When connecting to a local ws echo_server, on my MacBook Pro 2015 I can send/receive around 30,000 messages per second. (cf #235)","title":"[10.1.4] - 2020-08-02"},{"location":"CHANGELOG/#1013-2020-08-02","text":"(ws) ws echo_server. Add a -q option to only enable warning and error log levels. This is useful for bench-marking so that we do not print a lot of things on the console. (cf #235)","title":"[10.1.3] - 2020-08-02"},{"location":"CHANGELOG/#1012-2020-07-31","text":"(build) make using zlib optional, with the caveat that some http and websocket features are not available when zlib is absent","title":"[10.1.2] - 2020-07-31"},{"location":"CHANGELOG/#1011-2020-07-29","text":"(websocket client) onProgressCallback not called for short messages on a websocket (fix #233)","title":"[10.1.1] - 2020-07-29"},{"location":"CHANGELOG/#1010-2020-07-29","text":"(websocket client) heartbeat is not sent at the requested frequency (fix #232)","title":"[10.1.0] - 2020-07-29"},{"location":"CHANGELOG/#1003-2020-07-28","text":"compiler warning fixes","title":"[10.0.3] - 2020-07-28"},{"location":"CHANGELOG/#1002-2020-07-28","text":"(ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting","title":"[10.0.2] - 2020-07-28"},{"location":"CHANGELOG/#1001-2020-07-27","text":"(socket utility) move ix::getFreePort to ixwebsocket library","title":"[10.0.1] - 2020-07-27"},{"location":"CHANGELOG/#1000-2020-07-25","text":"(ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr as its first argument","title":"[10.0.0] - 2020-07-25"},{"location":"CHANGELOG/#9107-2020-07-25","text":"(ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better.","title":"[9.10.7] - 2020-07-25"},{"location":"CHANGELOG/#9106-2020-07-24","text":"(ws) port broadcast_server sub-command to the new server API","title":"[9.10.6] - 2020-07-24"},{"location":"CHANGELOG/#9105-2020-07-24","text":"(unittest) port most unittests to the new server API","title":"[9.10.5] - 2020-07-24"},{"location":"CHANGELOG/#9103-2020-07-24","text":"(ws) port ws transfer to the new server API","title":"[9.10.3] - 2020-07-24"},{"location":"CHANGELOG/#9102-2020-07-24","text":"(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor","title":"[9.10.2] - 2020-07-24"},{"location":"CHANGELOG/#9101-2020-07-24","text":"(websocket server) reset client websocket callback when the connection is closed","title":"[9.10.1] - 2020-07-24"},{"location":"CHANGELOG/#9100-2020-07-23","text":"(websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did","title":"[9.10.0] - 2020-07-23"},{"location":"CHANGELOG/#993-2020-07-17","text":"(build) merge platform specific files which were used to have different implementations for setting a thread name into a single file, to make it easier to include every source files and build the ixwebsocket library (fix #226)","title":"[9.9.3] - 2020-07-17"},{"location":"CHANGELOG/#992-2020-07-10","text":"(socket server) bump default max connection count from 32 to 128","title":"[9.9.2] - 2020-07-10"},{"location":"CHANGELOG/#991-2020-07-10","text":"(snake) implement super simple stream sql expression support in snake server","title":"[9.9.1] - 2020-07-10"},{"location":"CHANGELOG/#990-2020-07-08","text":"(socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made","title":"[9.9.0] - 2020-07-08"},{"location":"CHANGELOG/#986-2020-07-06","text":"(cmake) change the way zlib and openssl are searched","title":"[9.8.6] - 2020-07-06"},{"location":"CHANGELOG/#985-2020-07-06","text":"(cobra python bots) remove the test which stop the bot when events do not follow cobra metrics system schema with an id and a device entry","title":"[9.8.5] - 2020-07-06"},{"location":"CHANGELOG/#984-2020-06-26","text":"(cobra bots) remove bots which is not required now that we can use Python extensions","title":"[9.8.4] - 2020-06-26"},{"location":"CHANGELOG/#983-2020-06-25","text":"(cmake) new python code is optional and enabled at cmake time with -DUSE_PYTHON=1","title":"[9.8.3] - 2020-06-25"},{"location":"CHANGELOG/#982-2020-06-24","text":"(cobra bots) new cobra metrics bot to send data to statsd using Python for processing the message","title":"[9.8.2] - 2020-06-24"},{"location":"CHANGELOG/#981-2020-06-19","text":"(cobra metrics to statsd bot) fps slow frame info : do not include os name","title":"[9.8.1] - 2020-06-19"},{"location":"CHANGELOG/#980-2020-06-19","text":"(cobra metrics to statsd bot) send info about memory warnings","title":"[9.8.0] - 2020-06-19"},{"location":"CHANGELOG/#979-2020-06-18","text":"(http client) fix deadlock when following redirects","title":"[9.7.9] - 2020-06-18"},{"location":"CHANGELOG/#978-2020-06-18","text":"(cobra metrics to statsd bot) send info about net requests","title":"[9.7.8] - 2020-06-18"},{"location":"CHANGELOG/#977-2020-06-17","text":"(cobra client and bots) add batch_size subscription option for retrieving multiple messages at once","title":"[9.7.7] - 2020-06-17"},{"location":"CHANGELOG/#976-2020-06-15","text":"(websocket) WebSocketServer is not a final class, so that users can extend it (fix #215)","title":"[9.7.6] - 2020-06-15"},{"location":"CHANGELOG/#975-2020-06-15","text":"(cobra bots) minor aesthetic change, in how we display http headers with a : then space as key value separator instead of :: with no space","title":"[9.7.5] - 2020-06-15"},{"location":"CHANGELOG/#974-2020-06-11","text":"(cobra metrics to statsd bot) change from a statsd type of gauge to a timing one","title":"[9.7.4] - 2020-06-11"},{"location":"CHANGELOG/#973-2020-06-11","text":"(redis cobra bots) capture most used devices in a zset","title":"[9.7.3] - 2020-06-11"},{"location":"CHANGELOG/#972-2020-06-11","text":"(ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise","title":"[9.7.2] - 2020-06-11"},{"location":"CHANGELOG/#971-2020-06-11","text":"(redis cobra bots) ws cobra metrics to redis / hostname invalid parsing","title":"[9.7.1] - 2020-06-11"},{"location":"CHANGELOG/#970-2020-06-11","text":"(redis cobra bots) xadd with maxlen + fix bug in xadd client implementation and ws cobra metrics to redis command argument parsing","title":"[9.7.0] - 2020-06-11"},{"location":"CHANGELOG/#969-2020-06-10","text":"(redis cobra bots) update the cobra to redis bot to use the bot framework, and change it to report fps metrics into redis streams.","title":"[9.6.9] - 2020-06-10"},{"location":"CHANGELOG/#966-2020-06-04","text":"(statsd cobra bots) statsd improvement: prefix does not need a dot as a suffix, message size can be larger than 256 bytes, error handling was invalid, use core logger for logging instead of std::cerr","title":"[9.6.6] - 2020-06-04"},{"location":"CHANGELOG/#965-2020-05-29","text":"(http server) support gzip compression","title":"[9.6.5] - 2020-05-29"},{"location":"CHANGELOG/#964-2020-05-20","text":"(compiler fix) support clang 5 and earlier (contributed by @LunarWatcher)","title":"[9.6.4] - 2020-05-20"},{"location":"CHANGELOG/#963-2020-05-18","text":"(cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL","title":"[9.6.3] - 2020-05-18"},{"location":"CHANGELOG/#962-2020-05-17","text":"(cmake) make install cmake files optional to not conflict with vcpkg","title":"[9.6.2] - 2020-05-17"},{"location":"CHANGELOG/#961-2020-05-17","text":"(windows + tls) mbedtls is the default windows tls backend + add ability to load system certificates with mbdetls on windows","title":"[9.6.1] - 2020-05-17"},{"location":"CHANGELOG/#960-2020-05-12","text":"(ixbots) add options to limit how many messages per minute should be processed","title":"[9.6.0] - 2020-05-12"},{"location":"CHANGELOG/#959-2020-05-12","text":"(ixbots) add new class to configure a bot to simplify passing options around","title":"[9.5.9] - 2020-05-12"},{"location":"CHANGELOG/#958-2020-05-08","text":"(openssl tls) (openssl < 1.1) logic inversion - crypto locking callback are not registered properly","title":"[9.5.8] - 2020-05-08"},{"location":"CHANGELOG/#957-2020-05-08","text":"(cmake) default TLS back to mbedtls on Windows Universal Platform","title":"[9.5.7] - 2020-05-08"},{"location":"CHANGELOG/#956-2020-05-06","text":"(cobra bots) add a --heartbeat_timeout option to specify when the bot should terminate because no events are received","title":"[9.5.6] - 2020-05-06"},{"location":"CHANGELOG/#955-2020-05-06","text":"(openssl tls) when OpenSSL is older than 1.1, register the crypto locking callback to be thread safe. Should fix lots of CI failures","title":"[9.5.5] - 2020-05-06"},{"location":"CHANGELOG/#954-2020-05-04","text":"(cobra bots) do not use a queue to store messages pending processing, let the bot handle queuing","title":"[9.5.4] - 2020-05-04"},{"location":"CHANGELOG/#953-2020-04-29","text":"(http client) better current request cancellation support when the HttpClient destructor is invoked (see #189)","title":"[9.5.3] - 2020-04-29"},{"location":"CHANGELOG/#952-2020-04-27","text":"(cmake) fix cmake broken tls option parsing","title":"[9.5.2] - 2020-04-27"},{"location":"CHANGELOG/#951-2020-04-27","text":"(http client) Set default values for most HttpRequestArgs struct members (fix #185)","title":"[9.5.1] - 2020-04-27"},{"location":"CHANGELOG/#950-2020-04-25","text":"(ssl) Default to OpenSSL on Windows, since it can load the system certificates by default","title":"[9.5.0] - 2020-04-25"},{"location":"CHANGELOG/#941-2020-04-25","text":"(header) Add a space between header name and header value since most http parsers expects it, although it it not required. Cf #184 and #155","title":"[9.4.1] - 2020-04-25"},{"location":"CHANGELOG/#940-2020-04-24","text":"(ssl) Add support for supplying SSL CA from memory, for OpenSSL and MbedTLS backends","title":"[9.4.0] - 2020-04-24"},{"location":"CHANGELOG/#933-2020-04-17","text":"(ixbots) display sent/receive message, per seconds as accumulated","title":"[9.3.3] - 2020-04-17"},{"location":"CHANGELOG/#932-2020-04-17","text":"(ws) add a --logfile option to configure all logs to go to a file","title":"[9.3.2] - 2020-04-17"},{"location":"CHANGELOG/#931-2020-04-16","text":"(cobra bots) add a utility class to factor out the common bots features (heartbeat) and move all bots to used it + convert cobra_subscribe to be a bot and add a unittest for it","title":"[9.3.1] - 2020-04-16"},{"location":"CHANGELOG/#930-2020-04-15","text":"(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent","title":"[9.3.0] - 2020-04-15"},{"location":"CHANGELOG/#929-2020-04-15","text":"(ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible","title":"[9.2.9] - 2020-04-15"},{"location":"CHANGELOG/#928-2020-04-15","text":"(ixcobra) make CobraConnection_EventType an enum class (CobraEventType)","title":"[9.2.8] - 2020-04-15"},{"location":"CHANGELOG/#927-2020-04-14","text":"(ixsentry) add a library method to upload a payload directly to sentry","title":"[9.2.7] - 2020-04-14"},{"location":"CHANGELOG/#926-2020-04-14","text":"(ixcobra) snake server / handle invalid incoming json messages + cobra subscriber in fluentd mode insert a created_at timestamp entry","title":"[9.2.6] - 2020-04-14"},{"location":"CHANGELOG/#925-2020-04-13","text":"(websocket) WebSocketMessagePtr is a unique_ptr instead of a shared_ptr","title":"[9.2.5] - 2020-04-13"},{"location":"CHANGELOG/#924-2020-04-13","text":"(websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations","title":"[9.2.4] - 2020-04-13"},{"location":"CHANGELOG/#923-2020-04-13","text":"(ws) add a --runtime option to ws cobra_subscribe to optionally limit how much time it will run","title":"[9.2.3] - 2020-04-13"},{"location":"CHANGELOG/#922-2020-04-04","text":"(third_party deps) fix #177, update bundled spdlog to 1.6.0","title":"[9.2.2] - 2020-04-04"},{"location":"CHANGELOG/#921-2020-04-04","text":"(windows) when using OpenSSL, the system store is used to populate the cacert. No need to ship a cacert.pem file with your app.","title":"[9.2.1] - 2020-04-04"},{"location":"CHANGELOG/#920-2020-04-04","text":"(windows) ci: windows build with TLS (mbedtls) + verify that we can be build with OpenSSL","title":"[9.2.0] - 2020-04-04"},{"location":"CHANGELOG/#919-2020-03-30","text":"(cobra to statsd bot) add ability to extract a numerical value and send a timer event to statsd, with the --timer option","title":"[9.1.9] - 2020-03-30"},{"location":"CHANGELOG/#918-2020-03-29","text":"(cobra to statsd bot) bot init was missing + capture socket error","title":"[9.1.8] - 2020-03-29"},{"location":"CHANGELOG/#917-2020-03-29","text":"(cobra to statsd bot) add ability to extract a numerical value and send a gauge event to statsd, with the --gauge option","title":"[9.1.7] - 2020-03-29"},{"location":"CHANGELOG/#916-2020-03-29","text":"(ws cobra subscriber) use a Json::StreamWriter to write to std::cout, and save one std::string allocation for each message printed","title":"[9.1.6] - 2020-03-29"},{"location":"CHANGELOG/#915-2020-03-29","text":"(docker) trim down docker image (300M -> 12M) / binary built without symbol and size optimization, and source code not copied over","title":"[9.1.5] - 2020-03-29"},{"location":"CHANGELOG/#914-2020-03-28","text":"(jsoncpp) update bundled copy to version 1.9.3 (at sha 3beb37ea14aec1bdce1a6d542dc464d00f4a6cec)","title":"[9.1.4] - 2020-03-28"},{"location":"CHANGELOG/#913-2020-03-27","text":"(docker) alpine docker build with release with debug info, and bundle ca-certificates","title":"[9.1.3] - 2020-03-27"},{"location":"CHANGELOG/#912-2020-03-26","text":"(mac ssl) rename DarwinSSL -> SecureTransport (see this too -> https://github.com/curl/curl/issues/3733)","title":"[9.1.2] - 2020-03-26"},{"location":"CHANGELOG/#911-2020-03-26","text":"(websocket) fix data race accessing _socket object without mutex protection when calling wakeUpFromPoll in WebSocketTransport.cpp","title":"[9.1.1] - 2020-03-26"},{"location":"CHANGELOG/#910-2020-03-26","text":"(ixcobra) add explicit event types for handshake, authentication and subscription failure, and handle those by exiting in ws_cobra_subcribe and friends","title":"[9.1.0] - 2020-03-26"},{"location":"CHANGELOG/#903-2020-03-24","text":"(ws connect) display statistics about how much time it takes to stop the connection","title":"[9.0.3] - 2020-03-24"},{"location":"CHANGELOG/#902-2020-03-24","text":"(socket) works with unique_ptr instead of shared_ptr in many places","title":"[9.0.2] - 2020-03-24"},{"location":"CHANGELOG/#901-2020-03-24","text":"(socket) selectInterrupt member is an unique_ptr instead of being a shared_ptr","title":"[9.0.1] - 2020-03-24"},{"location":"CHANGELOG/#900-2020-03-23","text":"(websocket) reset per-message deflate codec everytime we connect to a server/client","title":"[9.0.0] - 2020-03-23"},{"location":"CHANGELOG/#834-2020-03-23","text":"(websocket) fix #167, a long standing issue with sending empty messages with per-message deflate extension (and hopefully other zlib bug)","title":"[8.3.4] - 2020-03-23"},{"location":"CHANGELOG/#833-2020-03-22","text":"(cobra to statsd) port to windows and add a unittest","title":"[8.3.3] - 2020-03-22"},{"location":"CHANGELOG/#832-2020-03-20","text":"(websocket+tls) fix hang in tls handshake which could lead to ANR, discovered through unittesting.","title":"[8.3.2] - 2020-03-20"},{"location":"CHANGELOG/#831-2020-03-20","text":"(cobra) CobraMetricsPublisher can be configure with an ix::CobraConfig + more unittest use SSL in server + client","title":"[8.3.1] - 2020-03-20"},{"location":"CHANGELOG/#830-2020-03-18","text":"(websocket) Simplify ping/pong based heartbeat implementation","title":"[8.3.0] - 2020-03-18"},{"location":"CHANGELOG/#827-2020-03-17","text":"(ws) ws connect gains a new option to set the interval at which to send pings (ws) ws echo_server gains a new option (-p) to disable responding to pings with pongs IXWebSocket$ ws connect --ping_interval 2 wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected [2020-03-17 23:53:02.726] [info] Uri: / [2020-03-17 23:53:02.726] [info] Headers: [2020-03-17 23:53:02.727] [info] Connection: Upgrade [2020-03-17 23:53:02.727] [info] Date: Wed, 18 Mar 2020 06:45:05 GMT [2020-03-17 23:53:02.727] [info] Sec-WebSocket-Accept: 0gtqbxW0aVL/QI/ICpLFnRaiKgA= [2020-03-17 23:53:02.727] [info] sec-websocket-extensions: [2020-03-17 23:53:02.727] [info] Server: Kaazing Gateway [2020-03-17 23:53:02.727] [info] Upgrade: websocket [2020-03-17 23:53:04.894] [info] Received pong [2020-03-17 23:53:06.859] [info] Received pong [2020-03-17 23:53:08.881] [info] Received pong [2020-03-17 23:53:10.848] [info] Received pong [2020-03-17 23:53:12.898] [info] Received pong [2020-03-17 23:53:14.865] [info] Received pong [2020-03-17 23:53:16.890] [info] Received pong [2020-03-17 23:53:18.853] [info] Received pong [2020-03-17 23:53:19.388] [info] ws_connect: connection closed: code 1000 reason Normal closure [2020-03-17 23:53:19.502] [info] Received 208 bytes [2020-03-17 23:53:19.502] [info] Sent 0 bytes","title":"[8.2.7] - 2020-03-17"},{"location":"CHANGELOG/#826-2020-03-16","text":"(cobra to sentry bot + docker) default docker file uses mbedtls + ws cobra_to_sentry pass tls options to sentryClient.","title":"[8.2.6] - 2020-03-16"},{"location":"CHANGELOG/#825-2020-03-13","text":"(cobra client) ws cobra subscribe resubscribe at latest position after being disconnected","title":"[8.2.5] - 2020-03-13"},{"location":"CHANGELOG/#824-2020-03-13","text":"(cobra client) can subscribe with a position","title":"[8.2.4] - 2020-03-13"},{"location":"CHANGELOG/#823-2020-03-13","text":"(cobra client) pass the message position to the subscription data callback","title":"[8.2.3] - 2020-03-13"},{"location":"CHANGELOG/#822-2020-03-12","text":"(openssl tls backend) Fix a hand in OpenSSL when using TLS v1.3 ... by disabling TLS v1.3","title":"[8.2.2] - 2020-03-12"},{"location":"CHANGELOG/#821-2020-03-11","text":"(cobra) IXCobraConfig struct has tlsOptions and per message deflate options","title":"[8.2.1] - 2020-03-11"},{"location":"CHANGELOG/#820-2020-03-11","text":"(cobra) add IXCobraConfig struct to pass cobra config around","title":"[8.2.0] - 2020-03-11"},{"location":"CHANGELOG/#819-2020-03-09","text":"(ws cobra_subscribe) add a --fluentd option to wrap a message in an enveloppe so that fluentd can recognize it","title":"[8.1.9] - 2020-03-09"},{"location":"CHANGELOG/#818-2020-03-02","text":"(websocket server) fix regression with disabling zlib extension on the server side. If a client does not support this extension the server will handle it fine. We still need to figure out how to disable the option.","title":"[8.1.8] - 2020-03-02"},{"location":"CHANGELOG/#817-2020-02-26","text":"(websocket) traffic tracker received bytes is message size while it should be wire size","title":"[8.1.7] - 2020-02-26"},{"location":"CHANGELOG/#816-2020-02-26","text":"(ws_connect) display sent/received bytes statistics on exit","title":"[8.1.6] - 2020-02-26"},{"location":"CHANGELOG/#815-2020-02-23","text":"(server) give thread name to some usual worker threads / unittest is broken !!","title":"[8.1.5] - 2020-02-23"},{"location":"CHANGELOG/#814-2020-02-22","text":"(websocket server) fix regression from 8.1.2, where per-deflate message compression was always disabled","title":"[8.1.4] - 2020-02-22"},{"location":"CHANGELOG/#813-2020-02-21","text":"(client + server) Fix #155 / http header parser should treat the space(s) after the : delimiter as optional. Fixing this bug made us discover that websocket sub-protocols are not properly serialiazed, but start with a ,","title":"[8.1.3] - 2020-02-21"},{"location":"CHANGELOG/#812-2020-02-18","text":"(WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server","title":"[8.1.2] - 2020-02-18"},{"location":"CHANGELOG/#811-2020-02-18","text":"(ws cobra to statsd and sentry sender) exit if no messages are received for one minute, which is a sign that something goes wrong on the server side. That should be changed to be configurable in the future","title":"[8.1.1] - 2020-02-18"},{"location":"CHANGELOG/#810-2020-02-13","text":"(http client + sentry minidump upload) Multipart stream closing boundary is invalid + mark some options as mandatory in the command line tools","title":"[8.1.0] - 2020-02-13"},{"location":"CHANGELOG/#807-2020-02-12","text":"(build) remove the unused subtree which was causing some way of installing to break","title":"[8.0.7] - 2020-02-12"},{"location":"CHANGELOG/#806-2020-01-31","text":"(snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections","title":"[8.0.6] - 2020-01-31"},{"location":"CHANGELOG/#805-2020-01-31","text":"(IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection","title":"[8.0.5] - 2020-01-31"},{"location":"CHANGELOG/#804-2020-01-31","text":"(cobra to sentry) remove noisy logging","title":"[8.0.4] - 2020-01-31"},{"location":"CHANGELOG/#803-2020-01-30","text":"(ixcobra) check if we are authenticated in publishNext before trying to publish a message","title":"[8.0.3] - 2020-01-30"},{"location":"CHANGELOG/#802-2020-01-28","text":"Extract severity level when emitting messages to sentry","title":"[8.0.2] - 2020-01-28"},{"location":"CHANGELOG/#801-2020-01-28","text":"Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry","title":"[8.0.1] - 2020-01-28"},{"location":"CHANGELOG/#800-2020-01-26","text":"(SocketServer) add ability to bind on an ipv6 address","title":"[8.0.0] - 2020-01-26"},{"location":"CHANGELOG/#796-2020-01-22","text":"(ws) add a dnslookup sub-command, to get the ip address of a remote host","title":"[7.9.6] - 2020-01-22"},{"location":"CHANGELOG/#795-2020-01-14","text":"(windows) fix #144, get rid of stubbed/un-implemented windows schannel ssl backend","title":"[7.9.5] - 2020-01-14"},{"location":"CHANGELOG/#794-2020-01-12","text":"(openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl","title":"[7.9.4] - 2020-01-12"},{"location":"CHANGELOG/#793-2020-01-10","text":"(apple ssl) model write method after the OpenSSL one for consistency","title":"[7.9.3] - 2020-01-10"},{"location":"CHANGELOG/#792-2020-01-06","text":"(apple ssl) unify read and write ssl utility code","title":"[7.9.2] - 2020-01-06"},{"location":"CHANGELOG/#791-2020-01-06","text":"(websocket client) better error propagation when errors are detected while sending data (ws send) detect failures to send big files, terminate in those cases and report error","title":"[7.9.1] - 2020-01-06"},{"location":"CHANGELOG/#790-2020-01-04","text":"(ws send) add option (-x) to disable per message deflate compression","title":"[7.9.0] - 2020-01-04"},{"location":"CHANGELOG/#789-2020-01-04","text":"(ws send + receive) handle all message types (ping + pong + fragment) / investigate #140","title":"[7.8.9] - 2020-01-04"},{"location":"CHANGELOG/#788-2019-12-28","text":"(mbedtls) fix related to private key file parsing and initialization","title":"[7.8.8] - 2019-12-28"},{"location":"CHANGELOG/#786-2019-12-28","text":"(ws cobra to sentry/statsd) fix for handling null events properly for empty queues + use queue to send data to statsd","title":"[7.8.6] - 2019-12-28"},{"location":"CHANGELOG/#785-2019-12-28","text":"(ws cobra to sentry) handle null events for empty queues","title":"[7.8.5] - 2019-12-28"},{"location":"CHANGELOG/#784-2019-12-27","text":"(ws cobra to sentry) game is picked in a fair manner, so that all games get the same share of sent events","title":"[7.8.4] - 2019-12-27"},{"location":"CHANGELOG/#783-2019-12-27","text":"(ws cobra to sentry) refactor queue related code into a class","title":"[7.8.3] - 2019-12-27"},{"location":"CHANGELOG/#782-2019-12-25","text":"(ws cobra to sentry) bound the queue size used to hold up cobra messages before they are sent to sentry. Default queue size is a 100 messages. Without such limit the program runs out of memory when a subscriber receive a lot of messages that cannot make it to sentry","title":"[7.8.2] - 2019-12-25"},{"location":"CHANGELOG/#781-2019-12-25","text":"(ws client) use correct compilation defines so that spdlog is not used as a header only library (reduce binary size and increase compilation speed)","title":"[7.8.1] - 2019-12-25"},{"location":"CHANGELOG/#780-2019-12-24","text":"(ws client) all commands use spdlog instead of std::cerr or std::cout for logging","title":"[7.8.0] - 2019-12-24"},{"location":"CHANGELOG/#765-2019-12-24","text":"(cobra client) send a websocket ping every 30s to keep the connection opened","title":"[7.6.5] - 2019-12-24"},{"location":"CHANGELOG/#764-2019-12-22","text":"(client) error handling, quote url in error case when failing to parse one (ws) ws_cobra_publish: register callbacks before connecting (doc) mention mbedtls in supported ssl server backend","title":"[7.6.4] - 2019-12-22"},{"location":"CHANGELOG/#763-2019-12-20","text":"(tls) add a simple description of the TLS configuration routine for debugging","title":"[7.6.3] - 2019-12-20"},{"location":"CHANGELOG/#762-2019-12-20","text":"(mbedtls) correct support for using own certificate and private key","title":"[7.6.2] - 2019-12-20"},{"location":"CHANGELOG/#761-2019-12-20","text":"(ws commands) in websocket proxy, disable automatic reconnections + in Dockerfile, use alpine 3.11","title":"[7.6.1] - 2019-12-20"},{"location":"CHANGELOG/#760-2019-12-19","text":"(cobra) Add TLS options to all cobra commands and classes. Add example to the doc.","title":"[7.6.0] - 2019-12-19"},{"location":"CHANGELOG/#758-2019-12-18","text":"(cobra-to-sentry) capture application version from device field","title":"[7.5.8] - 2019-12-18"},{"location":"CHANGELOG/#757-2019-12-18","text":"(tls) Experimental TLS server support with mbedtls (windows) + process cert tlsoption (client + server)","title":"[7.5.7] - 2019-12-18"},{"location":"CHANGELOG/#756-2019-12-18","text":"(tls servers) Make it clear that apple ssl and mbedtls backends do not support SSL in server mode","title":"[7.5.6] - 2019-12-18"},{"location":"CHANGELOG/#755-2019-12-17","text":"(tls options client) TLSOptions struct _validated member should be initialized to false","title":"[7.5.5] - 2019-12-17"},{"location":"CHANGELOG/#754-2019-12-16","text":"(websocket client) improve the error message when connecting to a non websocket server Before: Connection error: Got bad status connecting to example.com:443, status: 200, HTTP Status line: HTTP/1.1 200 OK After: Connection error: Expecting status 101 (Switching Protocol), got 200 status connecting to example.com:443, HTTP Status line: HTTP/1.1 200 OK","title":"[7.5.4] - 2019-12-16"},{"location":"CHANGELOG/#753-2019-12-12","text":"(server) attempt at fixing #131 by using blocking writes in server mode","title":"[7.5.3] - 2019-12-12"},{"location":"CHANGELOG/#752-2019-12-11","text":"(ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages","title":"[7.5.2] - 2019-12-11"},{"location":"CHANGELOG/#751-2019-12-06","text":"(mac) convert SSL errors to utf8","title":"[7.5.1] - 2019-12-06"},{"location":"CHANGELOG/#750-2019-12-05","text":"(ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry. In the example below sentry we are sending data too fast, sentry asks us to slow down which we do. Notice how the sent count stop increasing, while we are waiting for 41 seconds. [2019-12-05 15:50:33.759] [info] messages received 2449 sent 3 [2019-12-05 15:50:34.759] [info] messages received 5533 sent 7 [2019-12-05 15:50:35.759] [info] messages received 8612 sent 11 [2019-12-05 15:50:36.759] [info] messages received 11562 sent 15 [2019-12-05 15:50:37.759] [info] messages received 14410 sent 19 [2019-12-05 15:50:38.759] [info] messages received 17236 sent 23 [2019-12-05 15:50:39.282] [error] Error sending data to sentry: 429 [2019-12-05 15:50:39.282] [error] Body: {\"exception\":[{\"stacktrace\":{\"frames\":[{\"filename\":\"WorldScene.lua\",\"function\":\"WorldScene.lua:1935\",\"lineno\":1958},{\"filename\":\"WorldScene.lua\",\"function\":\"onUpdate_WorldCam\",\"lineno\":1921},{\"filename\":\"WorldMapTile.lua\",\"function\":\"__index\",\"lineno\":239}]},\"value\":\"noisytypes: Attempt to call nil(nil,2224139838)!\"}],\"platform\":\"python\",\"sdk\":{\"name\":\"ws\",\"version\":\"1.0.0\"},\"tags\":[[\"game\",\"niso\"],[\"userid\",\"107638363\"],[\"environment\",\"live\"]],\"timestamp\":\"2019-12-05T23:50:39Z\"} [2019-12-05 15:50:39.282] [error] Response: {\"error_name\":\"rate_limit\",\"error\":\"Creation of this event was denied due to rate limiting\"} [2019-12-05 15:50:39.282] [warning] Error 429 - Too Many Requests. ws will sleep and retry after 41 seconds [2019-12-05 15:50:39.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:40.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:41.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:42.761] [info] messages received 18839 sent 25 [2019-12-05 15:50:43.762] [info] messages received 18839 sent 25 [2019-12-05 15:50:44.763] [info] messages received 18839 sent 25 [2019-12-05 15:50:45.768] [info] messages received 18839 sent 25","title":"[7.5.0] - 2019-12-05"},{"location":"CHANGELOG/#745-2019-12-03","text":"(ws) #125 / fix build problem when jsoncpp is not installed locally","title":"[7.4.5] - 2019-12-03"},{"location":"CHANGELOG/#744-2019-12-03","text":"(ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present","title":"[7.4.4] - 2019-12-03"},{"location":"CHANGELOG/#743-2019-12-03","text":"(http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases","title":"[7.4.3] - 2019-12-03"},{"location":"CHANGELOG/#742-2019-12-02","text":"(client) internal IXDNSLookup class requires a valid cancellation request function callback to be passed in","title":"[7.4.2] - 2019-12-02"},{"location":"CHANGELOG/#741-2019-12-02","text":"(client) fix an overflow in the exponential back off code","title":"[7.4.1] - 2019-12-02"},{"location":"CHANGELOG/#740-2019-11-25","text":"(http client) Add support for multipart HTTP POST upload (ixsentry) Add support for uploading a minidump to sentry","title":"[7.4.0] - 2019-11-25"},{"location":"CHANGELOG/#735-2019-11-20","text":"On Darwin SSL, add ability to skip peer verification.","title":"[7.3.5] - 2019-11-20"},{"location":"CHANGELOG/#734-2019-11-20","text":"32-bits compile fix, courtesy of @fcojavmc","title":"[7.3.4] - 2019-11-20"},{"location":"CHANGELOG/#731-2019-11-16","text":"ws proxy_server / remote server close not forwarded to the client","title":"[7.3.1] - 2019-11-16"},{"location":"CHANGELOG/#730-2019-11-15","text":"New ws command: ws proxy_server .","title":"[7.3.0] - 2019-11-15"},{"location":"CHANGELOG/#722-2019-11-01","text":"Tag a release + minor reformating.","title":"[7.2.2] - 2019-11-01"},{"location":"CHANGELOG/#721-2019-10-26","text":"Add unittest to IXSentryClient to lua backtrace parsing code","title":"[7.2.1] - 2019-10-26"},{"location":"CHANGELOG/#720-2019-10-24","text":"Add cobra_metrics_to_redis sub-command to create streams for each cobra metric event being received.","title":"[7.2.0] - 2019-10-24"},{"location":"CHANGELOG/#710-2019-10-13","text":"Add client support for websocket subprotocol. Look for the new addSubProtocol method for details.","title":"[7.1.0] - 2019-10-13"},{"location":"CHANGELOG/#700-2019-10-01","text":"TLS support in server code, only implemented for the OpenSSL SSL backend for now.","title":"[7.0.0] - 2019-10-01"},{"location":"CHANGELOG/#634-2019-09-30","text":"all ws subcommands propagate tls options to servers (unimplemented) or ws or http client (implemented) (contributed by Matt DeBoer)","title":"[6.3.4] - 2019-09-30"},{"location":"CHANGELOG/#633-2019-09-30","text":"ws has a --version option","title":"[6.3.3] - 2019-09-30"},{"location":"CHANGELOG/#632-2019-09-29","text":"(http + websocket clients) can specify cacert and some other tls options (not implemented on all backend). This makes it so that server certs can finally be validated on windows.","title":"[6.3.2] - 2019-09-29"},{"location":"CHANGELOG/#631-2019-09-29","text":"Add ability to use OpenSSL on apple platforms.","title":"[6.3.1] - 2019-09-29"},{"location":"CHANGELOG/#630-2019-09-28","text":"ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher","title":"[6.3.0] - 2019-09-28"},{"location":"CHANGELOG/#629-2019-09-27","text":"mbedtls fixes / the unittest now pass on macOS, and hopefully will on Windows/AppVeyor as well.","title":"[6.2.9] - 2019-09-27"},{"location":"CHANGELOG/#628-2019-09-26","text":"Http server: add options to ws https to redirect all requests to a given url. POST requests will get a 200 and an empty response. ws httpd -L --redirect_url https://www.google.com","title":"[6.2.8] - 2019-09-26"},{"location":"CHANGELOG/#627-2019-09-25","text":"Stop having ws send subcommand send a binary message in text mode, which would cause error in make ws_test shell script test.","title":"[6.2.7] - 2019-09-25"},{"location":"CHANGELOG/#626-2019-09-24","text":"Fix 2 race conditions detected with TSan, one in CobraMetricsPublisher::push and another one in WebSocketTransport::sendData (that one was bad).","title":"[6.2.6] - 2019-09-24"},{"location":"CHANGELOG/#625-2019-09-23","text":"Add simple Redis Server which is only capable of doing publish / subscribe. New ws redis_server sub-command to use it. The server is used in the unittest, so that we can run on CI in environment where redis isn not available like github actions env.","title":"[6.2.5] - 2019-09-23"},{"location":"CHANGELOG/#624-2019-09-22","text":"Add options to configure TLS ; contributed by Matt DeBoer. Only implemented for OpenSSL TLS backend for now.","title":"[6.2.4] - 2019-09-22"},{"location":"CHANGELOG/#623-2019-09-21","text":"Fix crash in the Linux unittest in the HTTP client code, in Socket::readBytes Cobra Metrics Publisher code returns the message id of the message that got published, to be used to validated that it got sent properly when receiving an ack.","title":"[6.2.3] - 2019-09-21"},{"location":"CHANGELOG/#622-2019-09-19","text":"In DNS lookup code, make sure the weak pointer we use lives through the expected scope (if branch)","title":"[6.2.2] - 2019-09-19"},{"location":"CHANGELOG/#621-2019-09-17","text":"On error while doing a client handshake, additionally display port number next to the host name","title":"[6.2.1] - 2019-09-17"},{"location":"CHANGELOG/#620-2019-09-09","text":"websocket and http server: server does not close the bound client socket in many cases improve some websocket error messages add a utility function with unittest to parse status line and stop using scanf which triggers warnings on Windows update ws CLI11 (our command line argument parsing library) to the latest, which fix a compiler bug about optional","title":"[6.2.0] - 2019-09-09"},{"location":"CHANGELOG/#610-2019-09-08","text":"move poll wrapper on top of select (only used on Windows) to the ix namespace","title":"[6.1.0] - 2019-09-08"},{"location":"CHANGELOG/#601-2019-09-05","text":"add cobra metrics publisher + server unittest add cobra client + server unittest ws snake (cobra simple server) add basic support for unsubscription + subscribe send the proper subscription data + redis client subscription can be cancelled IXCobraConnection / pdu handlers can crash if they receive json data which is not an object","title":"[6.0.1] - 2019-09-05"},{"location":"CHANGELOG/#600-2019-09-04","text":"all client autobahn test should pass ! zlib/deflate has a bug with windowsbits == 8, so we silently upgrade it to 9/ (fix autobahn test 13.X which uses 8 for the windows size)","title":"[6.0.0] - 2019-09-04"},{"location":"CHANGELOG/#520-2019-09-04","text":"Fragmentation: for sent messages which are compressed, the continuation fragments should not have the rsv1 bit set (fix all autobahn tests for zlib compression 12.X) Websocket Server / do a case insensitive string search when looking for an Upgrade header whose value is websocket. (some client use WebSocket with some upper-case characters)","title":"[5.2.0] - 2019-09-04"},{"location":"CHANGELOG/#519-2019-09-03","text":"ws autobahn / report progress with spdlog::info to get timing info ws autobahn / use condition variables for stopping test case + add more logging on errors","title":"[5.1.9] - 2019-09-03"},{"location":"CHANGELOG/#518-2019-09-03","text":"Per message deflate/compression: handle fragmented messages (fix autobahn test: 12.1.X and probably others)","title":"[5.1.8] - 2019-09-03"},{"location":"CHANGELOG/#517-2019-09-03","text":"Receiving invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)","title":"[5.1.7] - 2019-09-03"},{"location":"CHANGELOG/#516-2019-09-03","text":"Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead. Validate that the reason is proper utf-8. (fix autobahn test 7.5.1) Validate close codes. Autobahn 7.9.*","title":"[5.1.6] - 2019-09-03"},{"location":"CHANGELOG/#515-2019-09-03","text":"Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation)","title":"[5.1.5] - 2019-09-03"},{"location":"CHANGELOG/#514-2019-09-03","text":"Sending invalid UTF-8 TEXT message should fail and close the connection (fix tons of autobahn test: 6.X UTF-8 Handling)","title":"[5.1.4] - 2019-09-03"},{"location":"CHANGELOG/#513-2019-09-03","text":"Message type (TEXT or BINARY) is invalid for received fragmented messages (fix autobahn test: 5.3 through 5.8 Fragmentation)","title":"[5.1.3] - 2019-09-03"},{"location":"CHANGELOG/#512-2019-09-02","text":"Ping and Pong messages cannot be fragmented (fix autobahn test: 5.1 and 5.2 Fragmentation)","title":"[5.1.2] - 2019-09-02"},{"location":"CHANGELOG/#511-2019-09-01","text":"Close connections when reserved bits are used (fix autobahn test: 3.X Reserved Bits)","title":"[5.1.1] - 2019-09-01"},{"location":"CHANGELOG/#510-2019-08-31","text":"ws autobahn / Add code to test websocket client compliance with the autobahn test-suite add utf-8 validation code, not hooked up properly yet Ping received with a payload too large (> 125 bytes) trigger a connection closure cobra / add tracking about published messages cobra / publish returns a message id, that can be used when cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system).","title":"[5.1.0] - 2019-08-31"},{"location":"CHANGELOG/#509-2019-08-30","text":"User-Agent header is set when not specified. New option to cap the max wait between reconnection attempts. Still default to 10s. (setMaxWaitBetweenReconnectionRetries). ws connect --max_wait 5000 ws://example.com # will only wait 5 seconds max between reconnection attempts","title":"[5.0.9] - 2019-08-30"},{"location":"CHANGELOG/#507-2019-08-23","text":"WebSocket: add new option to pass in extra HTTP headers when connecting. ws connect add new option (-H, works like curl ) to pass in extra HTTP headers when connecting If you run against ws echo_server you will see the headers being received printed in the terminal. ws connect -H \"foo: bar\" -H \"baz: buz\" ws://127.0.0.1:8008 CobraConnection: sets a unique id field for all messages sent to cobra . CobraConnection: sets a counter as a field for each event published.","title":"[5.0.7] - 2019-08-23"},{"location":"CHANGELOG/#506-2019-08-22","text":"Windows: silly compile error (poll should be in the global namespace)","title":"[5.0.6] - 2019-08-22"},{"location":"CHANGELOG/#505-2019-08-22","text":"Windows: use select instead of WSAPoll, through a poll wrapper","title":"[5.0.5] - 2019-08-22"},{"location":"CHANGELOG/#504-2019-08-20","text":"Windows build fixes (there was a problem with the use of ::poll that has a different name on Windows (WSAPoll))","title":"[5.0.4] - 2019-08-20"},{"location":"CHANGELOG/#503-2019-08-14","text":"CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default","title":"[5.0.3] - 2019-08-14"},{"location":"CHANGELOG/#502-2019-08-01","text":"ws cobra_subscribe has a new -q (quiet) option ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) ws cobra_subscribe, cobra_to_statsd and cobra_to_sentry commands have a new option, --filter to restrict the events they want to receive","title":"[5.0.2] - 2019-08-01"},{"location":"CHANGELOG/#501-2019-07-25","text":"ws connect command has a new option to send in binary mode (still default to text) ws connect command has readline history thanks to libnoise-cpp. Now ws connect one can use using arrows to lookup previous sent messages and edit them","title":"[5.0.1] - 2019-07-25"},{"location":"CHANGELOG/#500-2019-06-23","text":"","title":"[5.0.0] - 2019-06-23"},{"location":"CHANGELOG/#changed","text":"New HTTP server / still very early. ws gained a new command, httpd can run a simple webserver serving local files. IXDNSLookup. Uses weak pointer + smart_ptr + shared_from_this instead of static sets + mutex to handle object going away before dns lookup has resolved cobra_to_sentry / backtraces are reversed and line number is not extracted correctly mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found travis CI uses g++ on Linux","title":"Changed"},{"location":"CHANGELOG/#400-2019-06-09","text":"","title":"[4.0.0] - 2019-06-09"},{"location":"CHANGELOG/#changed_1","text":"WebSocket::send() sends message in TEXT mode by default WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text WebSocket::send takes a third arg, binary which default to true (can be text too) WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg Add explicit WebSocket::sendBinary method New headers + WebSocketMessage class to hold message data, still not used across the board Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility. ws echo_server has a -g option to print a greeting message on connect IXSocketMbedTLS: better error handling in close and connect","title":"Changed"},{"location":"CHANGELOG/#312-2019-06-06","text":"","title":"[3.1.2] - 2019-06-06"},{"location":"CHANGELOG/#added","text":"ws connect has a -x option to disable per message deflate Add WebSocket::disablePerMessageDeflate() option.","title":"Added"},{"location":"CHANGELOG/#300-2019-06-xx","text":"","title":"[3.0.0] - 2019-06-xx"},{"location":"CHANGELOG/#changed_2","text":"TLS, aka SSL works on Windows (websocket and http clients) ws command line tool build on Windows Async API for HttpClient HttpClient API changed to use shared_ptr for response and request","title":"Changed"},{"location":"build/","text":"Build CMake CMakefiles for the library and the examples are available. This library has few dependencies, so it is possible to just add the source files into your project. Otherwise the usual way will suffice. mkdir build # make a build dir so that you can build out of tree. cd build cmake -DUSE_TLS=1 .. make -j make install # will install to /usr/local on Unix, on macOS it is a good idea to sudo chown -R `whoami`:staff /usr/local Headers and a static library will be installed to the target dir. There is a unittest which can be executed by typing make test . Options for building: -DBUILD_SHARED_LIBS=ON will build the unittest as a shared libary instead of a static library, which is the default -DUSE_ZLIB=1 will enable zlib support, required for http client + server + websocket per message deflate extension -DUSE_TLS=1 will enable TLS support -DUSE_OPEN_SSL=1 will use openssl for the TLS support (default on Linux and Windows). When using a custom version of openssl (say a prebuilt version, odd runtime problems can happens, as in #319, and special cmake trickery will be required (see this comment ) -DUSE_MBED_TLS=1 will use mbedlts for the TLS support -DUSE_WS=1 will build the ws interactive command line tool -DUSE_TEST=1 will build the unittest If you are on Windows, look at the appveyor file (not maintained much though) or rather the github actions which have instructions for building dependencies. It is also possible to externally include the project, so that everything is fetched over the wire when you build like so: ExternalProject_Add( IXWebSocket GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git ... ) vcpkg It is possible to get IXWebSocket through Microsoft vcpkg . vcpkg install ixwebsocket To use the installed package within a cmake project, use the following: set(CMAKE_TOOLCHAIN_FILE \"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" CACHE STRING \"\") # this is super important in order for cmake to include the vcpkg search/lib paths! # find library and its headers find_path(IXWEBSOCKET_INCLUDE_DIR ixwebsocket/IXWebSocket.h) find_library(IXWEBSOCKET_LIBRARY ixwebsocket) # include headers include_directories(${IXWEBSOCKET_INCLUDE_DIR}) # ... target_link_libraries(${PROJECT_NAME} ... ${IXWEBSOCKET_LIBRARY}) # Cmake will automatically fail the generation if the lib was not found, i.e is set to NOTFOUND Conan Conan is currently supported through a recipe in Conan Center ( Bintray entry ). Package reference Conan 1.21.0 and up: ixwebsocket/7.9.2 Earlier versions: ixwebsocket/7.9.2@_/_ Note that the version listed here might not be the latest one. See Bintray or the recipe itself for the latest version. If you're migrating from the previous, custom Bintray remote, note that the package reference has to be lower-case. Docker There is a Dockerfile for running the unittest on Linux, and to run the ws tool. It is also available on the docker registry. docker run docker.pkg.github.com/machinezone/ixwebsocket/ws:latest --help To use docker-compose you must make a docker container first. $ make docker ... $ docker compose up & ... $ docker exec -it ixwebsocket_ws_1 bash app@ca2340eb9106:~$ ws --help ws is a websocket tool ...","title":"Build"},{"location":"build/#build","text":"","title":"Build"},{"location":"build/#cmake","text":"CMakefiles for the library and the examples are available. This library has few dependencies, so it is possible to just add the source files into your project. Otherwise the usual way will suffice. mkdir build # make a build dir so that you can build out of tree. cd build cmake -DUSE_TLS=1 .. make -j make install # will install to /usr/local on Unix, on macOS it is a good idea to sudo chown -R `whoami`:staff /usr/local Headers and a static library will be installed to the target dir. There is a unittest which can be executed by typing make test . Options for building: -DBUILD_SHARED_LIBS=ON will build the unittest as a shared libary instead of a static library, which is the default -DUSE_ZLIB=1 will enable zlib support, required for http client + server + websocket per message deflate extension -DUSE_TLS=1 will enable TLS support -DUSE_OPEN_SSL=1 will use openssl for the TLS support (default on Linux and Windows). When using a custom version of openssl (say a prebuilt version, odd runtime problems can happens, as in #319, and special cmake trickery will be required (see this comment ) -DUSE_MBED_TLS=1 will use mbedlts for the TLS support -DUSE_WS=1 will build the ws interactive command line tool -DUSE_TEST=1 will build the unittest If you are on Windows, look at the appveyor file (not maintained much though) or rather the github actions which have instructions for building dependencies. It is also possible to externally include the project, so that everything is fetched over the wire when you build like so: ExternalProject_Add( IXWebSocket GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git ... )","title":"CMake"},{"location":"build/#vcpkg","text":"It is possible to get IXWebSocket through Microsoft vcpkg . vcpkg install ixwebsocket To use the installed package within a cmake project, use the following: set(CMAKE_TOOLCHAIN_FILE \"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" CACHE STRING \"\") # this is super important in order for cmake to include the vcpkg search/lib paths! # find library and its headers find_path(IXWEBSOCKET_INCLUDE_DIR ixwebsocket/IXWebSocket.h) find_library(IXWEBSOCKET_LIBRARY ixwebsocket) # include headers include_directories(${IXWEBSOCKET_INCLUDE_DIR}) # ... target_link_libraries(${PROJECT_NAME} ... ${IXWEBSOCKET_LIBRARY}) # Cmake will automatically fail the generation if the lib was not found, i.e is set to NOTFOUND","title":"vcpkg"},{"location":"build/#conan","text":"Conan is currently supported through a recipe in Conan Center ( Bintray entry ). Package reference Conan 1.21.0 and up: ixwebsocket/7.9.2 Earlier versions: ixwebsocket/7.9.2@_/_ Note that the version listed here might not be the latest one. See Bintray or the recipe itself for the latest version. If you're migrating from the previous, custom Bintray remote, note that the package reference has to be lower-case.","title":"Conan"},{"location":"build/#docker","text":"There is a Dockerfile for running the unittest on Linux, and to run the ws tool. It is also available on the docker registry. docker run docker.pkg.github.com/machinezone/ixwebsocket/ws:latest --help To use docker-compose you must make a docker container first. $ make docker ... $ docker compose up & ... $ docker exec -it ixwebsocket_ws_1 bash app@ca2340eb9106:~$ ws --help ws is a websocket tool ...","title":"Docker"},{"location":"design/","text":"Implementation details Per Message Deflate compression. The per message deflate compression option is supported. It can lead to very nice bandbwith savings (20x !) if your messages are similar, which is often the case for example for chat applications. All features of the spec should be supported. TLS/SSL Connections can be optionally secured and encrypted with TLS/SSL when using a wss:// endpoint, or using normal un-encrypted socket with ws:// endpoints. AppleSSL is used on iOS and macOS, OpenSSL and mbedTLS can be used on Android, Linux and Windows. If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Polling and background thread work No manual polling to fetch data is required. Data is sent and received instantly by using a background thread for receiving data and the select system call to be notified by the OS of incoming data. No timeout is used for select so that the background thread is only woken up when data is available, to optimize battery life. This is also the recommended way of using select according to the select tutorial, section select law . Read and Writes to the socket are non blocking. Data is sent right away and not enqueued by writing directly to the socket, which is possible since system socket implementations allow concurrent read/writes. Automatic reconnection If the remote end (server) breaks the connection, the code will try to perpetually reconnect, by using an exponential backoff strategy, capped at one retry every 10 seconds. This behavior can be disabled. Large messages Large frames are broken up into smaller chunks or messages to avoid filling up the os tcp buffers, which is permitted thanks to WebSocket fragmentation . Messages up to 1G were sent and received succesfully. Testing The library has an interactive tool which is handy for testing compatibility ith other libraries. We have tested our client against Python, Erlang, Node.js, and C++ websocket server libraries. The unittest tries to be comprehensive, and has been running on multiple platforms, with different sanitizers such as a thread sanitizer to catch data races or the undefined behavior sanitizer. The regression test is running after each commit on github actions for multiple configurations. Limitations On some configuration (mostly Android) certificate validation needs to be setup so that SocketTLSOptions.caFile point to a pem file, such as the one distributed by Firefox. Unless that setup is done connecting to a wss endpoint will display an error. With mbedtls the message will contain error in handshake : X509 - Certificate verification failed, e.g. CRL, CA or signature check failed . Automatic reconnection works at the TCP socket level, and will detect remote end disconnects. However, if the device/computer network become unreachable (by turning off wifi), it is quite hard to reliably and timely detect it at the socket level using recv and send error codes. Here is a good discussion on the subject. This behavior is consistent with other runtimes such as node.js. One way to detect a disconnected device with low level C code is to do a name resolution with DNS but this can be expensive. Mobile devices have good and reliable API to do that. The server code is using select to detect incoming data, and creates one OS thread per connection. This is not as scalable as strategies using epoll or kqueue. C++ code organization Here is a simplistic diagram which explains how the code is structured in term of class/modules. +-----------------------+ --- Public | | Start the receiving Background thread. Auto reconnection. Simple websocket Ping. | IXWebSocket | Interface used by C++ test clients. No IX dependencies. | | +-----------------------+ | | | IXWebSocketServer | Run a server and give each connections its own WebSocket object. | | Each connection is handled in a new OS thread. | | +-----------------------+ --- Private | | | IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient. | | +-----------------------+ | | | IXWebSocketHandshake | Establish the connection between client and server. | | +-----------------------+ | | | IXWebSocket | ws:// Unencrypted Socket handler | IXWebSocketAppleSSL | wss:// TLS encrypted Socket AppleSSL handler. Used on iOS and macOS | IXWebSocketOpenSSL | wss:// TLS encrypted Socket OpenSSL handler. Used on Android and Linux | | Can be used on macOS too. +-----------------------+ | | | IXSocketConnect | Connect to the remote host (client). | | +-----------------------+ | | | IXDNSLookup | Does DNS resolution asynchronously so that it can be interrupted. | | +-----------------------+","title":"Design"},{"location":"design/#implementation-details","text":"","title":"Implementation details"},{"location":"design/#per-message-deflate-compression","text":"The per message deflate compression option is supported. It can lead to very nice bandbwith savings (20x !) if your messages are similar, which is often the case for example for chat applications. All features of the spec should be supported.","title":"Per Message Deflate compression."},{"location":"design/#tlsssl","text":"Connections can be optionally secured and encrypted with TLS/SSL when using a wss:// endpoint, or using normal un-encrypted socket with ws:// endpoints. AppleSSL is used on iOS and macOS, OpenSSL and mbedTLS can be used on Android, Linux and Windows. If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x.","title":"TLS/SSL"},{"location":"design/#polling-and-background-thread-work","text":"No manual polling to fetch data is required. Data is sent and received instantly by using a background thread for receiving data and the select system call to be notified by the OS of incoming data. No timeout is used for select so that the background thread is only woken up when data is available, to optimize battery life. This is also the recommended way of using select according to the select tutorial, section select law . Read and Writes to the socket are non blocking. Data is sent right away and not enqueued by writing directly to the socket, which is possible since system socket implementations allow concurrent read/writes.","title":"Polling and background thread work"},{"location":"design/#automatic-reconnection","text":"If the remote end (server) breaks the connection, the code will try to perpetually reconnect, by using an exponential backoff strategy, capped at one retry every 10 seconds. This behavior can be disabled.","title":"Automatic reconnection"},{"location":"design/#large-messages","text":"Large frames are broken up into smaller chunks or messages to avoid filling up the os tcp buffers, which is permitted thanks to WebSocket fragmentation . Messages up to 1G were sent and received succesfully.","title":"Large messages"},{"location":"design/#testing","text":"The library has an interactive tool which is handy for testing compatibility ith other libraries. We have tested our client against Python, Erlang, Node.js, and C++ websocket server libraries. The unittest tries to be comprehensive, and has been running on multiple platforms, with different sanitizers such as a thread sanitizer to catch data races or the undefined behavior sanitizer. The regression test is running after each commit on github actions for multiple configurations.","title":"Testing"},{"location":"design/#limitations","text":"On some configuration (mostly Android) certificate validation needs to be setup so that SocketTLSOptions.caFile point to a pem file, such as the one distributed by Firefox. Unless that setup is done connecting to a wss endpoint will display an error. With mbedtls the message will contain error in handshake : X509 - Certificate verification failed, e.g. CRL, CA or signature check failed . Automatic reconnection works at the TCP socket level, and will detect remote end disconnects. However, if the device/computer network become unreachable (by turning off wifi), it is quite hard to reliably and timely detect it at the socket level using recv and send error codes. Here is a good discussion on the subject. This behavior is consistent with other runtimes such as node.js. One way to detect a disconnected device with low level C code is to do a name resolution with DNS but this can be expensive. Mobile devices have good and reliable API to do that. The server code is using select to detect incoming data, and creates one OS thread per connection. This is not as scalable as strategies using epoll or kqueue.","title":"Limitations"},{"location":"design/#c-code-organization","text":"Here is a simplistic diagram which explains how the code is structured in term of class/modules. +-----------------------+ --- Public | | Start the receiving Background thread. Auto reconnection. Simple websocket Ping. | IXWebSocket | Interface used by C++ test clients. No IX dependencies. | | +-----------------------+ | | | IXWebSocketServer | Run a server and give each connections its own WebSocket object. | | Each connection is handled in a new OS thread. | | +-----------------------+ --- Private | | | IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient. | | +-----------------------+ | | | IXWebSocketHandshake | Establish the connection between client and server. | | +-----------------------+ | | | IXWebSocket | ws:// Unencrypted Socket handler | IXWebSocketAppleSSL | wss:// TLS encrypted Socket AppleSSL handler. Used on iOS and macOS | IXWebSocketOpenSSL | wss:// TLS encrypted Socket OpenSSL handler. Used on Android and Linux | | Can be used on macOS too. +-----------------------+ | | | IXSocketConnect | Connect to the remote host (client). | | +-----------------------+ | | | IXDNSLookup | Does DNS resolution asynchronously so that it can be interrupted. | | +-----------------------+","title":"C++ code organization"},{"location":"packages/","text":"Notes on how we can update the different packages for ixwebsocket. VCPKG Visit the releases page on Github. A tag must have been made first. Download the latest entry. $ cd /tmp /tmp$ curl -s -O -L https://github.com/machinezone/IXWebSocket/archive/v9.1.9.tar.gz /tmp$ /tmp$ openssl sha512 v9.1.9.tar.gz SHA512(v9.1.9.tar.gz)= f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e Now go punch those values in the vcpkg ixwebsocket port config files. Here is what the diff look like. vcpkg$ git diff diff --git a/ports/ixwebsocket/CONTROL b/ports/ixwebsocket/CONTROL index db9c2adc9..4acae5c3f 100644 --- a/ports/ixwebsocket/CONTROL +++ b/ports/ixwebsocket/CONTROL @@ -1,5 +1,5 @@ Source: ixwebsocket -Version: 8.0.5 +Version: 9.1.9 Build-Depends: zlib Homepage: https://github.com/machinezone/IXWebSocket Description: Lightweight WebSocket Client and Server + HTTP Client and Server diff --git a/ports/ixwebsocket/portfile.cmake b/ports/ixwebsocket/portfile.cmake index de082aece..68e523a05 100644 --- a/ports/ixwebsocket/portfile.cmake +++ b/ports/ixwebsocket/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO machinezone/IXWebSocket - REF v8.0.5 - SHA512 9dcc20d9a0629b92c62a68a8bd7c8206f18dbd9e93289b0b687ec13c478ce9ad1f3563b38c399c8277b0d3812cc78ca725786ba1dedbc3445b9bdb9b689e8add + REF v9.1.9 + SHA512 f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e ) You will need a fork of the vcpkg repo to make a pull request. git fetch upstream git co master git reset --hard upstream/master git push origin master --force Make the pull request (I use a new branch to do that). vcpkg$ git co -b feature/ixwebsocket_9.1.9 M ports/ixwebsocket/CONTROL M ports/ixwebsocket/portfile.cmake Switched to a new branch 'feature/ixwebsocket_9.1.9' vcpkg$ vcpkg$ vcpkg$ git commit -am 'ixwebsocket: update to 9.1.9' [feature/ixwebsocket_9.1.9 8587a4881] ixwebsocket: update to 9.1.9 2 files changed, 3 insertions(+), 3 deletions(-) vcpkg$ vcpkg$ git push fatal: The current branch feature/ixwebsocket_9.1.9 has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin feature/ixwebsocket_9.1.9 vcpkg$ git push --set-upstream origin feature/ixwebsocket_9.1.9 Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 621 bytes | 621.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 4 local objects. remote: remote: Create a pull request for 'feature/ixwebsocket_9.1.9' on GitHub by visiting: remote: https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9 remote: To https://github.com/bsergean/vcpkg.git * [new branch] feature/ixwebsocket_9.1.9 -> feature/ixwebsocket_9.1.9 Branch 'feature/ixwebsocket_9.1.9' set up to track remote branch 'feature/ixwebsocket_9.1.9' from 'origin' by rebasing. vcpkg$ Just visit this url, https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9, printed on the console, to make the pull request.","title":"Packages"},{"location":"packages/#vcpkg","text":"Visit the releases page on Github. A tag must have been made first. Download the latest entry. $ cd /tmp /tmp$ curl -s -O -L https://github.com/machinezone/IXWebSocket/archive/v9.1.9.tar.gz /tmp$ /tmp$ openssl sha512 v9.1.9.tar.gz SHA512(v9.1.9.tar.gz)= f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e Now go punch those values in the vcpkg ixwebsocket port config files. Here is what the diff look like. vcpkg$ git diff diff --git a/ports/ixwebsocket/CONTROL b/ports/ixwebsocket/CONTROL index db9c2adc9..4acae5c3f 100644 --- a/ports/ixwebsocket/CONTROL +++ b/ports/ixwebsocket/CONTROL @@ -1,5 +1,5 @@ Source: ixwebsocket -Version: 8.0.5 +Version: 9.1.9 Build-Depends: zlib Homepage: https://github.com/machinezone/IXWebSocket Description: Lightweight WebSocket Client and Server + HTTP Client and Server diff --git a/ports/ixwebsocket/portfile.cmake b/ports/ixwebsocket/portfile.cmake index de082aece..68e523a05 100644 --- a/ports/ixwebsocket/portfile.cmake +++ b/ports/ixwebsocket/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO machinezone/IXWebSocket - REF v8.0.5 - SHA512 9dcc20d9a0629b92c62a68a8bd7c8206f18dbd9e93289b0b687ec13c478ce9ad1f3563b38c399c8277b0d3812cc78ca725786ba1dedbc3445b9bdb9b689e8add + REF v9.1.9 + SHA512 f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e ) You will need a fork of the vcpkg repo to make a pull request. git fetch upstream git co master git reset --hard upstream/master git push origin master --force Make the pull request (I use a new branch to do that). vcpkg$ git co -b feature/ixwebsocket_9.1.9 M ports/ixwebsocket/CONTROL M ports/ixwebsocket/portfile.cmake Switched to a new branch 'feature/ixwebsocket_9.1.9' vcpkg$ vcpkg$ vcpkg$ git commit -am 'ixwebsocket: update to 9.1.9' [feature/ixwebsocket_9.1.9 8587a4881] ixwebsocket: update to 9.1.9 2 files changed, 3 insertions(+), 3 deletions(-) vcpkg$ vcpkg$ git push fatal: The current branch feature/ixwebsocket_9.1.9 has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin feature/ixwebsocket_9.1.9 vcpkg$ git push --set-upstream origin feature/ixwebsocket_9.1.9 Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 621 bytes | 621.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 4 local objects. remote: remote: Create a pull request for 'feature/ixwebsocket_9.1.9' on GitHub by visiting: remote: https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9 remote: To https://github.com/bsergean/vcpkg.git * [new branch] feature/ixwebsocket_9.1.9 -> feature/ixwebsocket_9.1.9 Branch 'feature/ixwebsocket_9.1.9' set up to track remote branch 'feature/ixwebsocket_9.1.9' from 'origin' by rebasing. vcpkg$ Just visit this url, https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9, printed on the console, to make the pull request.","title":"VCPKG"},{"location":"performance/","text":"WebSocket Client performance We will run a client and a server on the same machine, connecting to localhost. This bench is run on a MacBook Pro from 2015. We can receive over 200,000 (small) messages per second, another way to put it is that it takes 5 micro-second to receive and process one message. This is an indication about the minimal latency to receive messages. Receiving messages By using the push_server ws sub-command, the server will send the same message in a loop to any connected client. ws push_server -q --send_msg 'yo' By using the echo_client ws sub-command, with the -m (mute or no_send), we will display statistics on how many messages we can receive per second. $ ws echo_client -m ws://localhost:8008 [2020-08-02 12:31:17.284] [info] ws_echo_client: connected [2020-08-02 12:31:17.284] [info] Uri: / [2020-08-02 12:31:17.284] [info] Headers: [2020-08-02 12:31:17.284] [info] Connection: Upgrade [2020-08-02 12:31:17.284] [info] Sec-WebSocket-Accept: byy/pMK2d0PtRwExaaiOnXJTQHo= [2020-08-02 12:31:17.284] [info] Server: ixwebsocket/10.1.4 macos ssl/SecureTransport zlib 1.2.11 [2020-08-02 12:31:17.284] [info] Upgrade: websocket [2020-08-02 12:31:17.663] [info] messages received: 0 per second 2595307 total [2020-08-02 12:31:18.668] [info] messages received: 79679 per second 2674986 total [2020-08-02 12:31:19.668] [info] messages received: 207438 per second 2882424 total [2020-08-02 12:31:20.673] [info] messages received: 209207 per second 3091631 total [2020-08-02 12:31:21.676] [info] messages received: 216056 per second 3307687 total [2020-08-02 12:31:22.680] [info] messages received: 214927 per second 3522614 total [2020-08-02 12:31:23.684] [info] messages received: 216960 per second 3739574 total [2020-08-02 12:31:24.688] [info] messages received: 215232 per second 3954806 total [2020-08-02 12:31:25.691] [info] messages received: 212300 per second 4167106 total [2020-08-02 12:31:26.694] [info] messages received: 212501 per second 4379607 total [2020-08-02 12:31:27.699] [info] messages received: 212330 per second 4591937 total [2020-08-02 12:31:28.702] [info] messages received: 216511 per second 4808448 total","title":"Performance"},{"location":"performance/#websocket-client-performance","text":"We will run a client and a server on the same machine, connecting to localhost. This bench is run on a MacBook Pro from 2015. We can receive over 200,000 (small) messages per second, another way to put it is that it takes 5 micro-second to receive and process one message. This is an indication about the minimal latency to receive messages.","title":"WebSocket Client performance"},{"location":"performance/#receiving-messages","text":"By using the push_server ws sub-command, the server will send the same message in a loop to any connected client. ws push_server -q --send_msg 'yo' By using the echo_client ws sub-command, with the -m (mute or no_send), we will display statistics on how many messages we can receive per second. $ ws echo_client -m ws://localhost:8008 [2020-08-02 12:31:17.284] [info] ws_echo_client: connected [2020-08-02 12:31:17.284] [info] Uri: / [2020-08-02 12:31:17.284] [info] Headers: [2020-08-02 12:31:17.284] [info] Connection: Upgrade [2020-08-02 12:31:17.284] [info] Sec-WebSocket-Accept: byy/pMK2d0PtRwExaaiOnXJTQHo= [2020-08-02 12:31:17.284] [info] Server: ixwebsocket/10.1.4 macos ssl/SecureTransport zlib 1.2.11 [2020-08-02 12:31:17.284] [info] Upgrade: websocket [2020-08-02 12:31:17.663] [info] messages received: 0 per second 2595307 total [2020-08-02 12:31:18.668] [info] messages received: 79679 per second 2674986 total [2020-08-02 12:31:19.668] [info] messages received: 207438 per second 2882424 total [2020-08-02 12:31:20.673] [info] messages received: 209207 per second 3091631 total [2020-08-02 12:31:21.676] [info] messages received: 216056 per second 3307687 total [2020-08-02 12:31:22.680] [info] messages received: 214927 per second 3522614 total [2020-08-02 12:31:23.684] [info] messages received: 216960 per second 3739574 total [2020-08-02 12:31:24.688] [info] messages received: 215232 per second 3954806 total [2020-08-02 12:31:25.691] [info] messages received: 212300 per second 4167106 total [2020-08-02 12:31:26.694] [info] messages received: 212501 per second 4379607 total [2020-08-02 12:31:27.699] [info] messages received: 212330 per second 4591937 total [2020-08-02 12:31:28.702] [info] messages received: 216511 per second 4808448 total","title":"Receiving messages"},{"location":"usage/","text":"Examples The ws folder countains many interactive programs for chat, file transfers , curl like http clients, demonstrating client and server usage. Windows note To use the network system on Windows, you need to initialize it once with WSAStartup() and clean it up with WSACleanup() . We have helpers for that which you can use, see below. This init would typically take place in your main function. #include int main() { ix::initNetSystem(); ... ix::uninitNetSystem(); return 0; } WebSocket client API #include ... // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // Optional heart beat, sent every 45 seconds when there is not any traffic // to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); // Per message deflate connection is enabled by default. You can tweak its parameters or disable it webSocket.disablePerMessageDeflate(); // Setup a callback to be fired when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << msg->str << std::endl; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // The message can be sent in BINARY mode (useful if you send MsgPack data for example) webSocket.sendBinary(\"some serialized binary data\"); // ... finally ... // Stop the connection webSocket.stop() Sending messages WebSocketSendInfo result = websocket.send(\"foo\") will send a message. If the connection was closed, sending will fail, and the success field of the result object will be set to false. There could also be a compression error in which case the compressError field will be set to true. The payloadSize field and wireSize fields will tell you respectively how much bytes the message weight, and how many bytes were sent on the wire (potentially compressed + counting the message header (a few bytes). There is an optional progress callback that can be passed in as the second argument. If a message is large it will be fragmented into chunks which will be sent independantly. Everytime the we can write a fragment into the OS network cache, the callback will be invoked. If a user wants to cancel a slow send, false should be returned from within the callback. Here is an example code snippet copied from the ws send sub-command. Each fragment weights 32K, so the total integer is the wireSize divided by 32K. As an example if you are sending 32M of data, uncompressed, total will be 1000. current will be set to 0 for the first fragment, then 1, 2 etc... auto result = _webSocket.sendBinary(serializedMsg, [this, throttle](int current, int total) -> bool { spdlog::info(\"ws_send: Step {} out of {}\", current + 1, total); if (throttle) { std::chrono::duration duration(10); std::this_thread::sleep_for(duration); } return _connected; }); The send() and sendText() methods check that the string contains only valid UTF-8 characters. If you know that the string is a valid UTF-8 string you can skip that step and use the sendUtf8Text method instead. With the IXWebSocketSendData overloads of sendUtf8Text and sendBinary it is possible to not only send std::string but also std::vector , std::vector and char* . std::vector data({1, 2, 3, 4}); auto result = webSocket.sendBinary(data); const char* text = \"Hello World!\"; result = webSocket.sendUtf8Text(IXWebSocketSendData(text, strlen(text))); ReadyState getReadyState() returns the state of the connection. There are 4 possible states. ReadyState::Connecting - The connection is not yet open. ReadyState::Open - The connection is open and ready to communicate. ReadyState::Closing - The connection is in the process of closing. ReadyState::Closed - The connection is closed or could not be opened. Open and Close notifications The onMessage event will be fired when the connection is opened or closed. This is similar to the JavaScript browser API , which has open and close events notification that can be registered with the browser addEventListener . webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"send greetings\" << std::endl; // Headers can be inspected (pairs of string/string) std::cout << \"Handshake Headers:\" << std::endl; for (auto it : msg->headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Close) { std::cout << \"disconnected\" << std::endl; // The server can send an explicit code and reason for closing. // This data can be accessed through the closeInfo object. std::cout << msg->closeInfo.code << std::endl; std::cout << msg->closeInfo.reason << std::endl; } } ); Error notification A message will be fired when there is an error with the connection. The message type will be ix::WebSocketMessageType::Error . Multiple fields will be available on the event to describe the error. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Error) { std::stringstream ss; ss << \"Error: \" << msg->errorInfo.reason << std::endl; ss << \"#retries: \" << msg->errorInfo.retries << std::endl; ss << \"Wait time(ms): \" << msg->errorInfo.wait_time << std::endl; ss << \"HTTP Status: \" << msg->errorInfo.http_status << std::endl; std::cout << ss.str() << std::endl; } } ); start, stop websocket.start() connect to the remote server and starts the message receiving background thread. websocket.stop() disconnect from the remote server and closes the background thread. Configuring the remote url The url can be set and queried after a websocket object has been created. You will have to call stop and start if you want to disconnect and connect to that new url. std::string url(\"wss://example.com\"); websocket.configure(url); Ping/Pong support Ping/pong messages are used to implement keep-alive. 2 message types exists to identify ping and pong messages. Note that when a ping message is received, a pong is instantly send back as requested by the WebSocket spec. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Ping || msg->type == ix::WebSocketMessageType::Pong) { std::cout << \"pong data: \" << msg->str << std::endl; } } ); A ping message can be sent to the server, with an optional data string. websocket.ping(\"ping data, optional (empty string is ok): limited to 125 bytes long\"); Heartbeat. You can configure an optional heart beat / keep-alive, sent every 45 seconds when there is no any traffic to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); Supply extra HTTP headers. You can set extra HTTP headers to be sent during the WebSocket handshake. WebSocketHttpHeaders headers; headers[\"foo\"] = \"bar\"; webSocket.setExtraHeaders(headers); Subprotocols You can specify subprotocols to be set during the WebSocket handshake. For more info you can refer to this doc . webSocket.addSubprotocol(\"appProtocol-v1\"); webSocket.addSubprotocol(\"appProtocol-v2\"); The protocol that the server did accept is available in the open info protocol field. std::cout << \"protocol: \" << msg->openInfo.protocol << std::endl; Automatic reconnection Automatic reconnection kicks in when the connection is disconnected without the user consent. This feature is on by default and can be turned off. webSocket.enableAutomaticReconnection(); // turn on webSocket.disableAutomaticReconnection(); // turn off bool enabled = webSocket.isAutomaticReconnectionEnabled(); // query state The technique to calculate wait time is called exponential backoff . Here are the default waiting times between attempts (from connecting with ws connect ws://foo.com ) > Connection error: Got bad status connecting to foo.com, status: 301, HTTP Status line: HTTP/1.1 301 Moved Permanently #retries: 1 Wait time(ms): 100 #retries: 2 Wait time(ms): 200 #retries: 3 Wait time(ms): 400 #retries: 4 Wait time(ms): 800 #retries: 5 Wait time(ms): 1600 #retries: 6 Wait time(ms): 3200 #retries: 7 Wait time(ms): 6400 #retries: 8 Wait time(ms): 10000 The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried. The minimum waiting time can also be set. webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries(); webSocket.setMinWaitBetweenReconnectionRetries(1000); // 1000ms = 1s uint32_t m = webSocket.getMinWaitBetweenReconnectionRetries(); Handshake timeout You can control how long to wait until timing out while waiting for the websocket handshake to be performed. int handshakeTimeoutSecs = 1; setHandshakeTimeout(handshakeTimeoutSecs); WebSocket server API Legacy api This api was actually changed to take a weak_ptr as the first argument to setOnConnectionCallback ; previously it would take a shared_ptr which was creating cycles and then memory leaks problems. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnConnectionCallback( [&server](std::weak_ptr webSocket, std::shared_ptr connectionState) { std::cout << \"Remote ip: \" << connectionState->remoteIp << std::endl; auto ws = webSocket.lock(); if (ws) { ws->setOnMessageCallback( [webSocket, connectionState, &server](const ix::WebSocketMessagePtr msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. auto ws = webSocket.lock(); if (ws) { ws->send(msg->str, msg->binary); } } } } ); } ); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait(); New api The new API does not require to use 2 nested callbacks, which is a bit annoying. The real fix is that there was a memory leak due to a shared_ptr cycle, due to passing down a shared_ptr down to the callbacks. The webSocket reference is guaranteed to be always valid ; by design the callback will never be invoked with a null webSocket object. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnClientMessageCallback([](std::shared_ptr connectionState, ix::WebSocket & webSocket, const ix::WebSocketMessagePtr & msg) { // The ConnectionState object contains information about the connection, // at this point only the client ip address and the port. std::cout << \"Remote ip: \" << connectionState->getRemoteIp() << std::endl; if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << \"\\t\" << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. std::cout << \"Received: \" << msg->str << std::endl; webSocket.send(msg->str, msg->binary); } }); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait(); Heartbeat You can configure an optional heartbeat / keep-alive for the WebSocket server. The heartbeat interval can be adjusted or disabled when constructing the WebSocketServer . Setting the interval to -1 disables the heartbeat feature; this is the default setting. The parameter you set will be applied to every WebSocket object that the server creates. To enable a 45 second heartbeat on a WebSocketServer : int pingIntervalSeconds = 45; ix::WebSocketServer server(port, host, backlog, maxConnections, handshakeTimeoutSecs, addressFamily, pingIntervalSeconds); HTTP client API #include ... // // Preparation // HttpClient httpClient; HttpRequestArgsPtr args = httpClient.createRequest(); // Custom headers can be set WebSocketHttpHeaders headers; headers[\"Foo\"] = \"bar\"; args->extraHeaders = headers; // Timeout options args->connectTimeout = connectTimeout; args->transferTimeout = transferTimeout; // Redirect options args->followRedirects = followRedirects; args->maxRedirects = maxRedirects; // Misc args->compress = compress; // Enable gzip compression args->verbose = verbose; args->logger = [](const std::string& msg) { std::cout << msg; }; // // Synchronous Request // HttpResponsePtr out; std::string url = \"https://www.google.com\"; // HEAD request out = httpClient.head(url, args); // GET request out = httpClient.get(url, args); // POST request with parameters HttpParameters httpParameters; httpParameters[\"foo\"] = \"bar\"; // HTTP form data can be passed in as well, for multi-part upload of files HttpFormDataParameters httpFormDataParameters; httpParameters[\"baz\"] = \"booz\"; out = httpClient.post(url, httpParameters, httpFormDataParameters, args); // POST request with a body out = httpClient.post(url, std::string(\"foo=bar\"), args); // PUT and PATCH are available too. // // Result // auto statusCode = response->statusCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... auto errorCode = response->errorCode; // 200, 404, etc... auto responseHeaders = response->headers; // All the headers in a special case-insensitive unordered_map of (string, string) auto body = response->body; // All the bytes from the response as an std::string auto errorMsg = response->errorMsg; // Descriptive error message in case of failure auto uploadSize = response->uploadSize; // Byte count of uploaded data auto downloadSize = response->downloadSize; // Byte count of downloaded data // // Asynchronous Request // bool async = true; HttpClient httpClient(async); auto args = httpClient.createRequest(url, HttpClient::kGet); // If you define a chunk callback it will be called repeteadly with the // incoming data. This allows to process data on the go or write it to disk // instead of accumulating the data in memory. args.onChunkCallback = [](const std::string& data) { // process data }; // Push the request to a queue, bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response) { // This callback execute in a background thread. Make sure you uses appropriate protection such as mutex auto statusCode = response->statusCode; // acess results // response->body is empty if onChunkCallback was used } ); // ok will be false if your httpClient is not async // A request in progress can be cancelled by setting the cancel flag. It does nothing if the request already completed. args->cancel = true; See this issue for links about uploading files with HTTP multipart. HTTP server API #include ix::HttpServer server(port, hostname); auto res = server.listen(); if (!res.first) { std::cerr << res.second << std::endl; return 1; } server.start(); server.wait(); If you want to handle how requests are processed, implement the setOnConnectionCallback callback, which takes an HttpRequestPtr as input, and returns an HttpResponsePtr. You can look at HttpServer::setDefaultConnectionCallback for a slightly more advanced callback example. setOnConnectionCallback( [this](HttpRequestPtr request, std::shared_ptr connectionState) -> HttpResponsePtr { // Build a string for the response std::stringstream ss; ss << connectionState->getRemoteIp(); << \" \" << request->method << \" \" << request->uri; std::string content = ss.str(); return std::make_shared(200, \"OK\", HttpErrorCode::Ok, WebSocketHttpHeaders(), content); } TLS support and configuration To leverage TLS features, the library must be compiled with the option USE_TLS=1 . If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Then, secure sockets are automatically used when connecting to a wss://* url. Additional TLS options can be configured by passing a ix::SocketTLSOptions instance to the setTLSOptions on ix::WebSocket (or ix::WebSocketServer or ix::HttpServer ) webSocket.setTLSOptions({ .certFile = \"path/to/cert/file.pem\", .keyFile = \"path/to/key/file.pem\", .caFile = \"path/to/trust/bundle/file.pem\", // as a file, or in memory buffer in PEM format .tls = true // required in server mode }); Specifying certFile and keyFile configures the certificate that will be used to communicate with TLS peers. On a client, this is only necessary for connecting to servers that require a client certificate. On a server, this is necessary for TLS support. Specifying caFile configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates. - The special value of SYSTEM (the default) indicates that the system-configured trust bundle should be used; this is generally what you want when connecting to any publicly exposed API/server. - The special value of NONE can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity. - If the value contain the special value -----BEGIN CERTIFICATE----- , the value will be read from memory, and not from a file. This is convenient on platforms like Android where reading / writing to the file system can be challenging without proper permissions, or without knowing the location of a temp directory. For a client, specifying caFile can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment. For a server, specifying caFile implies that: 1. You require clients to present a certificate 1. It must be signed by one of the trusted roots in the file By default, a destination's hostname is always validated against the certificate that it presents. To accept certificates with any hostname, set ix::SocketTLSOptions::disable_hostname_validation to true .","title":"Examples"},{"location":"usage/#examples","text":"The ws folder countains many interactive programs for chat, file transfers , curl like http clients, demonstrating client and server usage.","title":"Examples"},{"location":"usage/#windows-note","text":"To use the network system on Windows, you need to initialize it once with WSAStartup() and clean it up with WSACleanup() . We have helpers for that which you can use, see below. This init would typically take place in your main function. #include int main() { ix::initNetSystem(); ... ix::uninitNetSystem(); return 0; }","title":"Windows note"},{"location":"usage/#websocket-client-api","text":"#include ... // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // Optional heart beat, sent every 45 seconds when there is not any traffic // to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); // Per message deflate connection is enabled by default. You can tweak its parameters or disable it webSocket.disablePerMessageDeflate(); // Setup a callback to be fired when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << msg->str << std::endl; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // The message can be sent in BINARY mode (useful if you send MsgPack data for example) webSocket.sendBinary(\"some serialized binary data\"); // ... finally ... // Stop the connection webSocket.stop()","title":"WebSocket client API"},{"location":"usage/#sending-messages","text":"WebSocketSendInfo result = websocket.send(\"foo\") will send a message. If the connection was closed, sending will fail, and the success field of the result object will be set to false. There could also be a compression error in which case the compressError field will be set to true. The payloadSize field and wireSize fields will tell you respectively how much bytes the message weight, and how many bytes were sent on the wire (potentially compressed + counting the message header (a few bytes). There is an optional progress callback that can be passed in as the second argument. If a message is large it will be fragmented into chunks which will be sent independantly. Everytime the we can write a fragment into the OS network cache, the callback will be invoked. If a user wants to cancel a slow send, false should be returned from within the callback. Here is an example code snippet copied from the ws send sub-command. Each fragment weights 32K, so the total integer is the wireSize divided by 32K. As an example if you are sending 32M of data, uncompressed, total will be 1000. current will be set to 0 for the first fragment, then 1, 2 etc... auto result = _webSocket.sendBinary(serializedMsg, [this, throttle](int current, int total) -> bool { spdlog::info(\"ws_send: Step {} out of {}\", current + 1, total); if (throttle) { std::chrono::duration duration(10); std::this_thread::sleep_for(duration); } return _connected; }); The send() and sendText() methods check that the string contains only valid UTF-8 characters. If you know that the string is a valid UTF-8 string you can skip that step and use the sendUtf8Text method instead. With the IXWebSocketSendData overloads of sendUtf8Text and sendBinary it is possible to not only send std::string but also std::vector , std::vector and char* . std::vector data({1, 2, 3, 4}); auto result = webSocket.sendBinary(data); const char* text = \"Hello World!\"; result = webSocket.sendUtf8Text(IXWebSocketSendData(text, strlen(text)));","title":"Sending messages"},{"location":"usage/#readystate","text":"getReadyState() returns the state of the connection. There are 4 possible states. ReadyState::Connecting - The connection is not yet open. ReadyState::Open - The connection is open and ready to communicate. ReadyState::Closing - The connection is in the process of closing. ReadyState::Closed - The connection is closed or could not be opened.","title":"ReadyState"},{"location":"usage/#open-and-close-notifications","text":"The onMessage event will be fired when the connection is opened or closed. This is similar to the JavaScript browser API , which has open and close events notification that can be registered with the browser addEventListener . webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"send greetings\" << std::endl; // Headers can be inspected (pairs of string/string) std::cout << \"Handshake Headers:\" << std::endl; for (auto it : msg->headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Close) { std::cout << \"disconnected\" << std::endl; // The server can send an explicit code and reason for closing. // This data can be accessed through the closeInfo object. std::cout << msg->closeInfo.code << std::endl; std::cout << msg->closeInfo.reason << std::endl; } } );","title":"Open and Close notifications"},{"location":"usage/#error-notification","text":"A message will be fired when there is an error with the connection. The message type will be ix::WebSocketMessageType::Error . Multiple fields will be available on the event to describe the error. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Error) { std::stringstream ss; ss << \"Error: \" << msg->errorInfo.reason << std::endl; ss << \"#retries: \" << msg->errorInfo.retries << std::endl; ss << \"Wait time(ms): \" << msg->errorInfo.wait_time << std::endl; ss << \"HTTP Status: \" << msg->errorInfo.http_status << std::endl; std::cout << ss.str() << std::endl; } } );","title":"Error notification"},{"location":"usage/#start-stop","text":"websocket.start() connect to the remote server and starts the message receiving background thread. websocket.stop() disconnect from the remote server and closes the background thread.","title":"start, stop"},{"location":"usage/#configuring-the-remote-url","text":"The url can be set and queried after a websocket object has been created. You will have to call stop and start if you want to disconnect and connect to that new url. std::string url(\"wss://example.com\"); websocket.configure(url);","title":"Configuring the remote url"},{"location":"usage/#pingpong-support","text":"Ping/pong messages are used to implement keep-alive. 2 message types exists to identify ping and pong messages. Note that when a ping message is received, a pong is instantly send back as requested by the WebSocket spec. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Ping || msg->type == ix::WebSocketMessageType::Pong) { std::cout << \"pong data: \" << msg->str << std::endl; } } ); A ping message can be sent to the server, with an optional data string. websocket.ping(\"ping data, optional (empty string is ok): limited to 125 bytes long\");","title":"Ping/Pong support"},{"location":"usage/#heartbeat","text":"You can configure an optional heart beat / keep-alive, sent every 45 seconds when there is no any traffic to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45);","title":"Heartbeat."},{"location":"usage/#supply-extra-http-headers","text":"You can set extra HTTP headers to be sent during the WebSocket handshake. WebSocketHttpHeaders headers; headers[\"foo\"] = \"bar\"; webSocket.setExtraHeaders(headers);","title":"Supply extra HTTP headers."},{"location":"usage/#subprotocols","text":"You can specify subprotocols to be set during the WebSocket handshake. For more info you can refer to this doc . webSocket.addSubprotocol(\"appProtocol-v1\"); webSocket.addSubprotocol(\"appProtocol-v2\"); The protocol that the server did accept is available in the open info protocol field. std::cout << \"protocol: \" << msg->openInfo.protocol << std::endl;","title":"Subprotocols"},{"location":"usage/#automatic-reconnection","text":"Automatic reconnection kicks in when the connection is disconnected without the user consent. This feature is on by default and can be turned off. webSocket.enableAutomaticReconnection(); // turn on webSocket.disableAutomaticReconnection(); // turn off bool enabled = webSocket.isAutomaticReconnectionEnabled(); // query state The technique to calculate wait time is called exponential backoff . Here are the default waiting times between attempts (from connecting with ws connect ws://foo.com ) > Connection error: Got bad status connecting to foo.com, status: 301, HTTP Status line: HTTP/1.1 301 Moved Permanently #retries: 1 Wait time(ms): 100 #retries: 2 Wait time(ms): 200 #retries: 3 Wait time(ms): 400 #retries: 4 Wait time(ms): 800 #retries: 5 Wait time(ms): 1600 #retries: 6 Wait time(ms): 3200 #retries: 7 Wait time(ms): 6400 #retries: 8 Wait time(ms): 10000 The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried. The minimum waiting time can also be set. webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries(); webSocket.setMinWaitBetweenReconnectionRetries(1000); // 1000ms = 1s uint32_t m = webSocket.getMinWaitBetweenReconnectionRetries();","title":"Automatic reconnection"},{"location":"usage/#handshake-timeout","text":"You can control how long to wait until timing out while waiting for the websocket handshake to be performed. int handshakeTimeoutSecs = 1; setHandshakeTimeout(handshakeTimeoutSecs);","title":"Handshake timeout"},{"location":"usage/#websocket-server-api","text":"","title":"WebSocket server API"},{"location":"usage/#legacy-api","text":"This api was actually changed to take a weak_ptr as the first argument to setOnConnectionCallback ; previously it would take a shared_ptr which was creating cycles and then memory leaks problems. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnConnectionCallback( [&server](std::weak_ptr webSocket, std::shared_ptr connectionState) { std::cout << \"Remote ip: \" << connectionState->remoteIp << std::endl; auto ws = webSocket.lock(); if (ws) { ws->setOnMessageCallback( [webSocket, connectionState, &server](const ix::WebSocketMessagePtr msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. auto ws = webSocket.lock(); if (ws) { ws->send(msg->str, msg->binary); } } } } ); } ); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait();","title":"Legacy api"},{"location":"usage/#new-api","text":"The new API does not require to use 2 nested callbacks, which is a bit annoying. The real fix is that there was a memory leak due to a shared_ptr cycle, due to passing down a shared_ptr down to the callbacks. The webSocket reference is guaranteed to be always valid ; by design the callback will never be invoked with a null webSocket object. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnClientMessageCallback([](std::shared_ptr connectionState, ix::WebSocket & webSocket, const ix::WebSocketMessagePtr & msg) { // The ConnectionState object contains information about the connection, // at this point only the client ip address and the port. std::cout << \"Remote ip: \" << connectionState->getRemoteIp() << std::endl; if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << \"\\t\" << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. std::cout << \"Received: \" << msg->str << std::endl; webSocket.send(msg->str, msg->binary); } }); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait();","title":"New api"},{"location":"usage/#heartbeat_1","text":"You can configure an optional heartbeat / keep-alive for the WebSocket server. The heartbeat interval can be adjusted or disabled when constructing the WebSocketServer . Setting the interval to -1 disables the heartbeat feature; this is the default setting. The parameter you set will be applied to every WebSocket object that the server creates. To enable a 45 second heartbeat on a WebSocketServer : int pingIntervalSeconds = 45; ix::WebSocketServer server(port, host, backlog, maxConnections, handshakeTimeoutSecs, addressFamily, pingIntervalSeconds);","title":"Heartbeat"},{"location":"usage/#http-client-api","text":"#include ... // // Preparation // HttpClient httpClient; HttpRequestArgsPtr args = httpClient.createRequest(); // Custom headers can be set WebSocketHttpHeaders headers; headers[\"Foo\"] = \"bar\"; args->extraHeaders = headers; // Timeout options args->connectTimeout = connectTimeout; args->transferTimeout = transferTimeout; // Redirect options args->followRedirects = followRedirects; args->maxRedirects = maxRedirects; // Misc args->compress = compress; // Enable gzip compression args->verbose = verbose; args->logger = [](const std::string& msg) { std::cout << msg; }; // // Synchronous Request // HttpResponsePtr out; std::string url = \"https://www.google.com\"; // HEAD request out = httpClient.head(url, args); // GET request out = httpClient.get(url, args); // POST request with parameters HttpParameters httpParameters; httpParameters[\"foo\"] = \"bar\"; // HTTP form data can be passed in as well, for multi-part upload of files HttpFormDataParameters httpFormDataParameters; httpParameters[\"baz\"] = \"booz\"; out = httpClient.post(url, httpParameters, httpFormDataParameters, args); // POST request with a body out = httpClient.post(url, std::string(\"foo=bar\"), args); // PUT and PATCH are available too. // // Result // auto statusCode = response->statusCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... auto errorCode = response->errorCode; // 200, 404, etc... auto responseHeaders = response->headers; // All the headers in a special case-insensitive unordered_map of (string, string) auto body = response->body; // All the bytes from the response as an std::string auto errorMsg = response->errorMsg; // Descriptive error message in case of failure auto uploadSize = response->uploadSize; // Byte count of uploaded data auto downloadSize = response->downloadSize; // Byte count of downloaded data // // Asynchronous Request // bool async = true; HttpClient httpClient(async); auto args = httpClient.createRequest(url, HttpClient::kGet); // If you define a chunk callback it will be called repeteadly with the // incoming data. This allows to process data on the go or write it to disk // instead of accumulating the data in memory. args.onChunkCallback = [](const std::string& data) { // process data }; // Push the request to a queue, bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response) { // This callback execute in a background thread. Make sure you uses appropriate protection such as mutex auto statusCode = response->statusCode; // acess results // response->body is empty if onChunkCallback was used } ); // ok will be false if your httpClient is not async // A request in progress can be cancelled by setting the cancel flag. It does nothing if the request already completed. args->cancel = true; See this issue for links about uploading files with HTTP multipart.","title":"HTTP client API"},{"location":"usage/#http-server-api","text":"#include ix::HttpServer server(port, hostname); auto res = server.listen(); if (!res.first) { std::cerr << res.second << std::endl; return 1; } server.start(); server.wait(); If you want to handle how requests are processed, implement the setOnConnectionCallback callback, which takes an HttpRequestPtr as input, and returns an HttpResponsePtr. You can look at HttpServer::setDefaultConnectionCallback for a slightly more advanced callback example. setOnConnectionCallback( [this](HttpRequestPtr request, std::shared_ptr connectionState) -> HttpResponsePtr { // Build a string for the response std::stringstream ss; ss << connectionState->getRemoteIp(); << \" \" << request->method << \" \" << request->uri; std::string content = ss.str(); return std::make_shared(200, \"OK\", HttpErrorCode::Ok, WebSocketHttpHeaders(), content); }","title":"HTTP server API"},{"location":"usage/#tls-support-and-configuration","text":"To leverage TLS features, the library must be compiled with the option USE_TLS=1 . If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Then, secure sockets are automatically used when connecting to a wss://* url. Additional TLS options can be configured by passing a ix::SocketTLSOptions instance to the setTLSOptions on ix::WebSocket (or ix::WebSocketServer or ix::HttpServer ) webSocket.setTLSOptions({ .certFile = \"path/to/cert/file.pem\", .keyFile = \"path/to/key/file.pem\", .caFile = \"path/to/trust/bundle/file.pem\", // as a file, or in memory buffer in PEM format .tls = true // required in server mode }); Specifying certFile and keyFile configures the certificate that will be used to communicate with TLS peers. On a client, this is only necessary for connecting to servers that require a client certificate. On a server, this is necessary for TLS support. Specifying caFile configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates. - The special value of SYSTEM (the default) indicates that the system-configured trust bundle should be used; this is generally what you want when connecting to any publicly exposed API/server. - The special value of NONE can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity. - If the value contain the special value -----BEGIN CERTIFICATE----- , the value will be read from memory, and not from a file. This is convenient on platforms like Android where reading / writing to the file system can be challenging without proper permissions, or without knowing the location of a temp directory. For a client, specifying caFile can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment. For a server, specifying caFile implies that: 1. You require clients to present a certificate 1. It must be signed by one of the trusted roots in the file By default, a destination's hostname is always validated against the certificate that it presents. To accept certificates with any hostname, set ix::SocketTLSOptions::disable_hostname_validation to true .","title":"TLS support and configuration"},{"location":"ws/","text":"General ws is a command line tool that should exercise most of the IXWebSocket code, and provide example code. ws is a websocket tool Usage: ws [OPTIONS] SUBCOMMAND Options: -h,--help Print this help message and exit Subcommands: send Send a file receive Receive a file transfer Broadcasting server connect Connect to a remote server chat Group chat echo_server Echo server broadcast_server Broadcasting server ping Ping pong curl HTTP Client httpd HTTP server curl The curl subcommand try to be compatible with the curl syntax, to fetch http pages. Making a HEAD request with the -I parameter. $ ws curl -I https://www.google.com/ Accept-Ranges: none Alt-Svc: quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Date: Tue, 08 Oct 2019 21:36:57 GMT Expires: -1 P3P: CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\" Server: gws Set-Cookie: NID=188=ASwfz8GrXQrHCLqAz-AndLOMLcz0rC9yecnf3h0yXZxRL3rTufTU_GDDwERp7qQL7LZ_EB8gCRyPXGERyOSAgaqgnrkoTmvWrwFemRLMaOZ896GrHobi5fV7VLklnSG2w48Gj8xMlwxfP7Z-bX-xR9UZxep1tHM6UmFQdD_GkBE; expires=Wed, 08-Apr-2020 21:36:57 GMT; path=/; domain=.google.com; HttpOnly Transfer-Encoding: chunked Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-XSS-Protection: 0 Upload size: 143 Download size: 0 Status: 200 Making a POST request with the -F parameter. $ ws curl -F foo=bar https://httpbin.org/post foo: bar Downloaded 438 bytes out of 438 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 438 Content-Type: application/json Date: Tue, 08 Oct 2019 21:47:54 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 219 Download size: 438 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } Passing in a custom header with -H. $ ws curl -F foo=bar -H 'my_custom_header: baz' https://httpbin.org/post my_custom_header: baz foo: bar Downloaded 470 bytes out of 470 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 470 Content-Type: application/json Date: Tue, 08 Oct 2019 21:50:25 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 243 Download size: 470 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"My-Custom-Header\": \"baz\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } connect The connect command connects to a websocket endpoint, and starts an interactive prompt. Line editing, such as using the direction keys to fetch the last thing you tried to type) is provided. That command is pretty useful to try to send random data to an endpoint and verify that the service handles it with grace (such as sending invalid json). ws connect wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected Uri: / Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:38:44 GMT Sec-WebSocket-Accept: 2j6LBScZveqrMx1W/GJkCWvZo3M= sec-websocket-extensions: Server: Kaazing Gateway Upgrade: websocket Received ping Received ping Received ping Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! > Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! ws connect 'ws://jeanserge.com/v2?appkey=_pubsub' Type Ctrl-D to exit prompt... Connecting to url: ws://jeanserge.com/v2?appkey=_pubsub > ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:28 GMT Sec-WebSocket-Accept: LYHmjh9Gsu/Yw7aumQqyPObOEV4= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket bababababababab > ws_connect: connection closed: code 1000 reason ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:44 GMT Sec-WebSocket-Accept: I1rqxdLgTU+opPi5/zKPBTuXdLw= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket It is possible to pass custom HTTP header when doing the connection handshake, the remote server might process them to implement a simple authorization scheme. src$ ws connect -H Authorization:supersecret ws://localhost:8008 Type Ctrl-D to exit prompt... [2020-12-17 22:35:08.732] [info] Authorization: supersecret Connecting to url: ws://localhost:8008 > [2020-12-17 22:35:08.736] [info] ws_connect: connected [2020-12-17 22:35:08.736] [info] Uri: / [2020-12-17 22:35:08.736] [info] Headers: [2020-12-17 22:35:08.736] [info] Connection: Upgrade [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Accept: 2yaTFcdwn8KL6IzSMj2u6Le7KTg= [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.736] [info] Server: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:08.736] [info] Upgrade: websocket [2020-12-17 22:35:08.736] [info] Received 25 bytes ws_connect: received message: Authorization suceeded! [2020-12-17 22:35:08.736] [info] Received pong ixwebsocket::heartbeat::30s::0 hello > [2020-12-17 22:35:25.157] [info] Received 7 bytes ws_connect: received message: hello If the wrong header is passed in, the server would close the connection with a custom close code (>4000, and <4999). [2020-12-17 22:39:37.044] [info] Upgrade: websocket ws_connect: connection closed: code 4001 reason Permission denied echo server The ws echo server will respond what the client just sent him. If we use the simple --http_authorization_header we can enforce that client need to pass a special value in the Authorization header to connect. $ ws echo_server --http_authorization_header supersecret [2020-12-17 22:35:06.192] [info] Listening on 127.0.0.1:8008 [2020-12-17 22:35:08.735] [info] New connection [2020-12-17 22:35:08.735] [info] remote ip: 127.0.0.1 [2020-12-17 22:35:08.735] [info] id: 0 [2020-12-17 22:35:08.735] [info] Uri: / [2020-12-17 22:35:08.735] [info] Headers: [2020-12-17 22:35:08.735] [info] Authorization: supersecret [2020-12-17 22:35:08.735] [info] Connection: Upgrade [2020-12-17 22:35:08.735] [info] Host: localhost:8008 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Key: eFF2Gf25dC7eC15Ab1135G== [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Version: 13 [2020-12-17 22:35:08.735] [info] Upgrade: websocket [2020-12-17 22:35:08.735] [info] User-Agent: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:25.157] [info] Received 7 bytes Websocket proxy ws proxy_server --remote_host ws://127.0.0.1:9000 -v Listening on 127.0.0.1:8008 If you connect to ws://127.0.0.1:8008, the proxy will connect to ws://127.0.0.1:9000 and pass all traffic to this server. You can also use a more complex setup if you want to redirect to different websocket servers based on the hostname your client is trying to connect to. If you have multiple CNAME aliases that point to the same server. A JSON config file is used to express that mapping ; here connecting to echo.jeanserge.com will proxy the client to ws://localhost:8008 on the local machine (which actually runs ws echo_server), while connecting to bavarde.jeanserge.com will proxy the client to ws://localhost:5678 where a cobra python server is running. As a side note you will need a wildcard SSL certificate if you want to have SSL enabled on that machine. echo.jeanserge.com=ws://localhost:8008 bavarde.jeanserge.com=ws://localhost:5678 The --config_path option is required to instruct ws proxy_server to read that file. ws proxy_server --config_path proxyConfig.json --port 8765 File transfer # Start transfer server, which is just a broadcast server at this point ws transfer # running on port 8080. # Start receiver first ws receive ws://localhost:8080 # Then send a file. File will be received and written to disk by the receiver process ws send ws://localhost:8080 /file/to/path HTTP Client $ ws curl --help HTTP Client Usage: ws curl [OPTIONS] url Positionals: url TEXT REQUIRED Connection url Options: -h,--help Print this help message and exit -d TEXT Form data -F TEXT Form data -H TEXT Header --output TEXT Output file -I Send a HEAD request -L Follow redirects --max-redirects INT Max Redirects -v Verbose -O Save output to disk --compress Enable gzip compression --connect-timeout INT Connection timeout --transfer-timeout INT Transfer timeout","title":"Ws"},{"location":"ws/#general","text":"ws is a command line tool that should exercise most of the IXWebSocket code, and provide example code. ws is a websocket tool Usage: ws [OPTIONS] SUBCOMMAND Options: -h,--help Print this help message and exit Subcommands: send Send a file receive Receive a file transfer Broadcasting server connect Connect to a remote server chat Group chat echo_server Echo server broadcast_server Broadcasting server ping Ping pong curl HTTP Client httpd HTTP server","title":"General"},{"location":"ws/#curl","text":"The curl subcommand try to be compatible with the curl syntax, to fetch http pages. Making a HEAD request with the -I parameter. $ ws curl -I https://www.google.com/ Accept-Ranges: none Alt-Svc: quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Date: Tue, 08 Oct 2019 21:36:57 GMT Expires: -1 P3P: CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\" Server: gws Set-Cookie: NID=188=ASwfz8GrXQrHCLqAz-AndLOMLcz0rC9yecnf3h0yXZxRL3rTufTU_GDDwERp7qQL7LZ_EB8gCRyPXGERyOSAgaqgnrkoTmvWrwFemRLMaOZ896GrHobi5fV7VLklnSG2w48Gj8xMlwxfP7Z-bX-xR9UZxep1tHM6UmFQdD_GkBE; expires=Wed, 08-Apr-2020 21:36:57 GMT; path=/; domain=.google.com; HttpOnly Transfer-Encoding: chunked Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-XSS-Protection: 0 Upload size: 143 Download size: 0 Status: 200 Making a POST request with the -F parameter. $ ws curl -F foo=bar https://httpbin.org/post foo: bar Downloaded 438 bytes out of 438 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 438 Content-Type: application/json Date: Tue, 08 Oct 2019 21:47:54 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 219 Download size: 438 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } Passing in a custom header with -H. $ ws curl -F foo=bar -H 'my_custom_header: baz' https://httpbin.org/post my_custom_header: baz foo: bar Downloaded 470 bytes out of 470 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 470 Content-Type: application/json Date: Tue, 08 Oct 2019 21:50:25 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 243 Download size: 470 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"My-Custom-Header\": \"baz\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" }","title":"curl"},{"location":"ws/#connect","text":"The connect command connects to a websocket endpoint, and starts an interactive prompt. Line editing, such as using the direction keys to fetch the last thing you tried to type) is provided. That command is pretty useful to try to send random data to an endpoint and verify that the service handles it with grace (such as sending invalid json). ws connect wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected Uri: / Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:38:44 GMT Sec-WebSocket-Accept: 2j6LBScZveqrMx1W/GJkCWvZo3M= sec-websocket-extensions: Server: Kaazing Gateway Upgrade: websocket Received ping Received ping Received ping Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! > Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! ws connect 'ws://jeanserge.com/v2?appkey=_pubsub' Type Ctrl-D to exit prompt... Connecting to url: ws://jeanserge.com/v2?appkey=_pubsub > ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:28 GMT Sec-WebSocket-Accept: LYHmjh9Gsu/Yw7aumQqyPObOEV4= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket bababababababab > ws_connect: connection closed: code 1000 reason ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:44 GMT Sec-WebSocket-Accept: I1rqxdLgTU+opPi5/zKPBTuXdLw= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket It is possible to pass custom HTTP header when doing the connection handshake, the remote server might process them to implement a simple authorization scheme. src$ ws connect -H Authorization:supersecret ws://localhost:8008 Type Ctrl-D to exit prompt... [2020-12-17 22:35:08.732] [info] Authorization: supersecret Connecting to url: ws://localhost:8008 > [2020-12-17 22:35:08.736] [info] ws_connect: connected [2020-12-17 22:35:08.736] [info] Uri: / [2020-12-17 22:35:08.736] [info] Headers: [2020-12-17 22:35:08.736] [info] Connection: Upgrade [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Accept: 2yaTFcdwn8KL6IzSMj2u6Le7KTg= [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.736] [info] Server: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:08.736] [info] Upgrade: websocket [2020-12-17 22:35:08.736] [info] Received 25 bytes ws_connect: received message: Authorization suceeded! [2020-12-17 22:35:08.736] [info] Received pong ixwebsocket::heartbeat::30s::0 hello > [2020-12-17 22:35:25.157] [info] Received 7 bytes ws_connect: received message: hello If the wrong header is passed in, the server would close the connection with a custom close code (>4000, and <4999). [2020-12-17 22:39:37.044] [info] Upgrade: websocket ws_connect: connection closed: code 4001 reason Permission denied","title":"connect"},{"location":"ws/#echo-server","text":"The ws echo server will respond what the client just sent him. If we use the simple --http_authorization_header we can enforce that client need to pass a special value in the Authorization header to connect. $ ws echo_server --http_authorization_header supersecret [2020-12-17 22:35:06.192] [info] Listening on 127.0.0.1:8008 [2020-12-17 22:35:08.735] [info] New connection [2020-12-17 22:35:08.735] [info] remote ip: 127.0.0.1 [2020-12-17 22:35:08.735] [info] id: 0 [2020-12-17 22:35:08.735] [info] Uri: / [2020-12-17 22:35:08.735] [info] Headers: [2020-12-17 22:35:08.735] [info] Authorization: supersecret [2020-12-17 22:35:08.735] [info] Connection: Upgrade [2020-12-17 22:35:08.735] [info] Host: localhost:8008 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Key: eFF2Gf25dC7eC15Ab1135G== [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Version: 13 [2020-12-17 22:35:08.735] [info] Upgrade: websocket [2020-12-17 22:35:08.735] [info] User-Agent: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:25.157] [info] Received 7 bytes","title":"echo server"},{"location":"ws/#websocket-proxy","text":"ws proxy_server --remote_host ws://127.0.0.1:9000 -v Listening on 127.0.0.1:8008 If you connect to ws://127.0.0.1:8008, the proxy will connect to ws://127.0.0.1:9000 and pass all traffic to this server. You can also use a more complex setup if you want to redirect to different websocket servers based on the hostname your client is trying to connect to. If you have multiple CNAME aliases that point to the same server. A JSON config file is used to express that mapping ; here connecting to echo.jeanserge.com will proxy the client to ws://localhost:8008 on the local machine (which actually runs ws echo_server), while connecting to bavarde.jeanserge.com will proxy the client to ws://localhost:5678 where a cobra python server is running. As a side note you will need a wildcard SSL certificate if you want to have SSL enabled on that machine. echo.jeanserge.com=ws://localhost:8008 bavarde.jeanserge.com=ws://localhost:5678 The --config_path option is required to instruct ws proxy_server to read that file. ws proxy_server --config_path proxyConfig.json --port 8765","title":"Websocket proxy"},{"location":"ws/#file-transfer","text":"# Start transfer server, which is just a broadcast server at this point ws transfer # running on port 8080. # Start receiver first ws receive ws://localhost:8080 # Then send a file. File will be received and written to disk by the receiver process ws send ws://localhost:8080 /file/to/path","title":"File transfer"},{"location":"ws/#http-client","text":"$ ws curl --help HTTP Client Usage: ws curl [OPTIONS] url Positionals: url TEXT REQUIRED Connection url Options: -h,--help Print this help message and exit -d TEXT Form data -F TEXT Form data -H TEXT Header --output TEXT Output file -I Send a HEAD request -L Follow redirects --max-redirects INT Max Redirects -v Verbose -O Save output to disk --compress Enable gzip compression --connect-timeout INT Connection timeout --transfer-timeout INT Transfer timeout","title":"HTTP Client"}]}
\ No newline at end of file
+{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing. It is been used on big mobile video game titles sending and receiving tons of messages since 2017 (iOS and Android). It was tested on macOS, iOS, Linux, Android, Windows and FreeBSD. Note that the MinGW compiler is not supported at this point. Two important design goals are simplicity and correctness. A bad security bug affecting users compiling with SSL enabled and OpenSSL as the backend was just fixed in newly released version 11.0.0. Please upgrade ! (more details in the https://github.com/machinezone/IXWebSocket/pull/250 . /* * main.cpp * Author: Benjamin Sergeant * Copyright (c) 2020 Machine Zone, Inc. All rights reserved. * * Super simple standalone example. See ws folder, unittest and doc/usage.md for more. * * On macOS * $ mkdir -p build ; (cd build ; cmake -DUSE_TLS=1 .. ; make -j ; make install) * $ clang++ --std=c++11 --stdlib=libc++ main.cpp -lixwebsocket -lz -framework Security -framework Foundation * $ ./a.out * * Or use cmake -DBUILD_DEMO=ON option for other platforms */ #include #include #include #include int main() { // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; // Connect to a server with encryption // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url(\"wss://echo.websocket.org\"); webSocket.setUrl(url); std::cout << \"Connecting to \" << url << \"...\" << std::endl; // Setup a callback to be fired (in a background thread, watch out for race conditions !) // when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << \"received message: \" << msg->str << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"Connection established\" << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Error) { // Maybe SSL is not configured properly std::cout << \"Connection error: \" << msg->errorInfo.reason << std::endl; std::cout << \"> \" << std::flush; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // Display a prompt std::cout << \"> \" << std::flush; std::string text; // Read text from the console and send messages in text mode. // Exit with Ctrl-D on Unix or Ctrl-Z on Windows. while (std::getline(std::cin, text)) { webSocket.send(text); std::cout << \"> \" << std::flush; } return 0; } Interested? Go read the docs ! If things don't work as expected, please create an issue on GitHub, or even better a pull request if you know how to fix your problem. IXWebSocket is actively being developed, check out the changelog to know what's cooking. If you are looking for a real time messaging service (the chat-like 'server' your websocket code will talk to) with many features such as history, backed by Redis, look at cobra . IXWebSocket client code is autobahn compliant beginning with the 6.0.0 version. See the current test results . Some tests are still failing in the server code. Starting with the 11.0.8 release, IXWebSocket should be fully C++11 compatible. Users If your company or project is using this library, feel free to open an issue or PR to amend this list. Machine Zone Tokio , a discord library focused on audio playback with node bindings. libDiscordBot , an easy to use Discord-bot framework. gwebsocket , a websocket (lua) module for Garry's Mod DisCPP , a simple but feature rich Discord API wrapper discord.cpp , a discord library for making bots Teleport , Teleport is your own personal remote robot avatar Alternative libraries There are plenty of great websocket libraries out there, which might work for you. Here are a couple of serious ones. websocketpp - C++ beast - C++ libwebsockets - C \u00b5WebSockets - C wslay - C uvweb is a library written by the IXWebSocket author which is built on top of uvw , which is a C++ wrapper for libuv . It has more dependencies and does not support SSL at this point, but it can be used to open multiple connections within a single OS thread thanks to libuv. To check the performance of a websocket library, you can look at the autoroute project. Continuous Integration OS TLS Sanitizer Status Linux OpenSSL None macOS Secure Transport Thread Sanitizer macOS OpenSSL Thread Sanitizer macOS MbedTLS Thread Sanitizer Windows Disabled None UWP Disabled None Linux OpenSSL Address Sanitizer Mingw Disabled None ASAN fails on Linux because of a known problem, we need a Some tests are disabled on Windows/UWP because of a pathing problem TLS and ZLIB are disabled on Windows/UWP because enabling make the CI run takes a lot of time, for setting up vcpkg.","title":"Home"},{"location":"#hello-world","text":"IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use and support everything you'll likely need for websocket dev (SSL, deflate compression, compiles on most platforms, etc...). HTTP client and server code is also available, but it hasn't received as much testing. It is been used on big mobile video game titles sending and receiving tons of messages since 2017 (iOS and Android). It was tested on macOS, iOS, Linux, Android, Windows and FreeBSD. Note that the MinGW compiler is not supported at this point. Two important design goals are simplicity and correctness. A bad security bug affecting users compiling with SSL enabled and OpenSSL as the backend was just fixed in newly released version 11.0.0. Please upgrade ! (more details in the https://github.com/machinezone/IXWebSocket/pull/250 . /* * main.cpp * Author: Benjamin Sergeant * Copyright (c) 2020 Machine Zone, Inc. All rights reserved. * * Super simple standalone example. See ws folder, unittest and doc/usage.md for more. * * On macOS * $ mkdir -p build ; (cd build ; cmake -DUSE_TLS=1 .. ; make -j ; make install) * $ clang++ --std=c++11 --stdlib=libc++ main.cpp -lixwebsocket -lz -framework Security -framework Foundation * $ ./a.out * * Or use cmake -DBUILD_DEMO=ON option for other platforms */ #include #include #include #include int main() { // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; // Connect to a server with encryption // See https://machinezone.github.io/IXWebSocket/usage/#tls-support-and-configuration std::string url(\"wss://echo.websocket.org\"); webSocket.setUrl(url); std::cout << \"Connecting to \" << url << \"...\" << std::endl; // Setup a callback to be fired (in a background thread, watch out for race conditions !) // when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << \"received message: \" << msg->str << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"Connection established\" << std::endl; std::cout << \"> \" << std::flush; } else if (msg->type == ix::WebSocketMessageType::Error) { // Maybe SSL is not configured properly std::cout << \"Connection error: \" << msg->errorInfo.reason << std::endl; std::cout << \"> \" << std::flush; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // Display a prompt std::cout << \"> \" << std::flush; std::string text; // Read text from the console and send messages in text mode. // Exit with Ctrl-D on Unix or Ctrl-Z on Windows. while (std::getline(std::cin, text)) { webSocket.send(text); std::cout << \"> \" << std::flush; } return 0; } Interested? Go read the docs ! If things don't work as expected, please create an issue on GitHub, or even better a pull request if you know how to fix your problem. IXWebSocket is actively being developed, check out the changelog to know what's cooking. If you are looking for a real time messaging service (the chat-like 'server' your websocket code will talk to) with many features such as history, backed by Redis, look at cobra . IXWebSocket client code is autobahn compliant beginning with the 6.0.0 version. See the current test results . Some tests are still failing in the server code. Starting with the 11.0.8 release, IXWebSocket should be fully C++11 compatible.","title":"Hello world"},{"location":"#users","text":"If your company or project is using this library, feel free to open an issue or PR to amend this list. Machine Zone Tokio , a discord library focused on audio playback with node bindings. libDiscordBot , an easy to use Discord-bot framework. gwebsocket , a websocket (lua) module for Garry's Mod DisCPP , a simple but feature rich Discord API wrapper discord.cpp , a discord library for making bots Teleport , Teleport is your own personal remote robot avatar","title":"Users"},{"location":"#alternative-libraries","text":"There are plenty of great websocket libraries out there, which might work for you. Here are a couple of serious ones. websocketpp - C++ beast - C++ libwebsockets - C \u00b5WebSockets - C wslay - C uvweb is a library written by the IXWebSocket author which is built on top of uvw , which is a C++ wrapper for libuv . It has more dependencies and does not support SSL at this point, but it can be used to open multiple connections within a single OS thread thanks to libuv. To check the performance of a websocket library, you can look at the autoroute project.","title":"Alternative libraries"},{"location":"#continuous-integration","text":"OS TLS Sanitizer Status Linux OpenSSL None macOS Secure Transport Thread Sanitizer macOS OpenSSL Thread Sanitizer macOS MbedTLS Thread Sanitizer Windows Disabled None UWP Disabled None Linux OpenSSL Address Sanitizer Mingw Disabled None ASAN fails on Linux because of a known problem, we need a Some tests are disabled on Windows/UWP because of a pathing problem TLS and ZLIB are disabled on Windows/UWP because enabling make the CI run takes a lot of time, for setting up vcpkg.","title":"Continuous Integration"},{"location":"CHANGELOG/","text":"Changelog All changes to this project will be documented in this file. [11.4.5] - 2024-06-05 New changes are documented in the Release page in the GitHub repository. [11.4.4] - 2023-06-05 [11.4.3] - 2022-05-13 Set shorter thread names BoringSSL fix with SNI Websocket computed header is valid Base64 [11.4.1] - 2022-04-23 vckpg + cmake fix, to handle zlib as a dependency better [11.4.0] - 2022-01-05 (Windows) Use wsa select event, which should lead to a much better behavior on Windows in general, and also when sending large payloads (#342) Fix \"HTTP/1.1 400 Illegal character CNTL=0xf\" caused by serverMaxWindowBits/clientMaxWindowBits being uint8_t (signed char). (#341) Export symbols into .def files Export symbols into .def files on MSVC (#339) Include to provide standard error constants (#338) Improved compatibility - fix mingw crossbuild (#337) Allow to cancel asynchronous HTTP requests (#332) Fix errors in example code. (#336) [11.3.2] - 2021-11-24 (server) Add getters for basic Servers properties (like port, host, etc...) (#327) + fix one compiler warning [11.3.1] - 2021-10-22 (library/cmake) Compatible with MbedTLS 3 + fix a bug on Windows where the incorrect remote port is computed (#320) [11.3.0] - 2021-09-20 (library/cmake) Only find OpenSSL, MbedTLS, zlib if they have not already been found, make CMake install optional (#317) + Use GNUInstallDirs in cmake (#318) [11.2.10] - 2021-07-27 (ws) bump CLI command line parsing library from 1.8 to 2.0 [11.2.9] - 2021-06-08 (ws) ws connect has a -g option to gzip decompress messages for API such as the websocket Huobi Global. [11.2.8] - 2021-06-03 (websocket client + server) WebSocketMessage class tweak to fix unsafe patterns [11.2.7] - 2021-05-27 (websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade) [11.2.6] - 2021-05-18 (Windows) move EINVAL (re)definition from IXSocket.h to IXNetSystem.h (fix #289) [11.2.5] - 2021-04-04 (http client) DEL is not an HTTP method name, but DELETE is [11.2.4] - 2021-03-25 (cmake) install IXUniquePtr.h [11.2.3] - 2021-03-24 (ssl + windows) missing include for CertOpenStore function [11.2.2] - 2021-03-23 (ixwebsocket) version bump [11.2.1] - 2021-03-23 (ixwebsocket) version bump [11.2.0] - 2021-03-23 (ixwebsocket) correct mingw support (gcc on windows) [11.1.4] - 2021-03-23 (ixwebsocket) add getMinWaitBetweenReconnectionRetries [11.1.3] - 2021-03-23 (ixwebsocket) New option to set the min wait between reconnection attempts. Still default to 1ms. (setMinWaitBetweenReconnectionRetries). [11.1.2] - 2021-03-22 (ws) initialize maxWaitBetweenReconnectionRetries to a non zero value ; a zero value was causing spurious reconnections attempts [11.1.1] - 2021-03-20 (cmake) Library can be built as a static or a dynamic library, controlled with BUILD_SHARED_LIBS. Default to static library [11.1.0] - 2021-03-16 (ixwebsocket) Use LEAN_AND_MEAN Windows define to help with undefined link error when building a DLL. Support websocket server disablePerMessageDeflate option correctly. [11.0.9] - 2021-03-07 (ixwebsocket) Expose setHandshakeTimeout method [11.0.8] - 2020-12-25 (ws) trim ws dependencies no more ixcrypto and ixcore deps [11.0.7] - 2020-12-25 (ws) trim ws dependencies, only depends on ixcrypto and ixcore [11.0.6] - 2020-12-22 (build) rename makefile to makefile.dev to ease cmake BuildExternal (fix #261) [11.0.5] - 2020-12-17 (ws) Implement simple header based websocket authorization technique to reject client which do not supply a certain header (\"Authorization\") with a special value (see doc). [11.0.4] - 2020-11-16 (ixwebsocket) Handle EINTR return code in ix::poll and IXSelectInterrupt [11.0.3] - 2020-11-16 (ixwebsocket) Fix #252 / regression in 11.0.2 with string comparisons [11.0.2] - 2020-11-15 (ixwebsocket) use a C++11 compatible make_unique shim [11.0.1] - 2020-11-11 (socket) replace a std::vector with an std::array used as a tmp buffer in Socket::readBytes [11.0.0] - 2020-11-11 (openssl security fix) in the client to server connection, peer verification is not done in all cases. See https://github.com/machinezone/IXWebSocket/pull/250 [10.5.7] - 2020-11-07 (docker) build docker container with zlib disabled [10.5.6] - 2020-11-07 (cmake) DEFLATE -> Deflate in CMake to stop warnings about casing [10.5.5] - 2020-11-07 (ws autoroute) Display result in compliant way (AUTOROUTE IXWebSocket :: N ms) so that result can be parsed easily [10.5.4] - 2020-10-30 (ws gunzip + IXGZipCodec) Can decompress gziped data with libdeflate. ws gunzip computed output filename was incorrect (was the extension aka gz) instead of the file without the extension. Also check whether the output file is writeable. [10.5.3] - 2020-10-19 (http code) With zlib disabled, some code should not be reached [10.5.2] - 2020-10-12 (ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb [10.5.1] - 2020-10-09 (http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present. [10.5.0] - 2020-09-30 (http client + server + ws) Add support for uploading files with ws -F foo=@filename, new -D http server option to debug incoming client requests, internal api changed for http POST, PUT and PATCH to supply an HttpFormDataParameters [10.4.9] - 2020-09-30 (http server + utility code) Add support for doing gzip compression with libdeflate library, if available [10.4.8] - 2020-09-30 (cmake) Stop using FetchContent cmake module to retrieve jsoncpp third party dependency [10.4.7] - 2020-09-28 (ws) add gzip and gunzip ws sub commands [10.4.6] - 2020-09-26 (cmake) use FetchContent cmake module to retrieve jsoncpp third party dependency [10.4.5] - 2020-09-26 (cmake) use FetchContent cmake module to retrieve spdlog third party dependency [10.4.4] - 2020-09-22 (cobra connection) retrieve cobra server connection id from the cobra handshake message and display it in ws clients, metrics publisher and bots [10.4.3] - 2020-09-22 (cobra 2 cobra) specify as an HTTP header which channel we will republish to [10.4.2] - 2020-09-18 (cobra bots) change an error log to a warning log when reconnecting because no messages were received for a minute [10.4.1] - 2020-09-18 (cobra connection and bots) set an HTTP header when connecting to help with debugging bots [10.4.0] - 2020-09-12 (http server) read body request when the Content-Length is specified + set timeout to read the request to 30 seconds max by default, and make it configurable as a constructor parameter [10.3.5] - 2020-09-09 (ws) autoroute command exit on its own once all messages have been received [10.3.4] - 2020-09-04 (docker) ws docker file installs strace [10.3.3] - 2020-09-02 (ws) echo_client command renamed to autoroute. Command exit once the server close the connection. push_server commands exit once N messages have been sent. [10.3.2] - 2020-08-31 (ws + cobra bots) add a cobra_to_cobra ws subcommand to subscribe to a channel and republish received events to a different channel [10.3.1] - 2020-08-28 (socket servers) merge the ConnectionInfo class with the ConnectionState one, which simplify all the server apis [10.3.0] - 2020-08-26 (ws) set the main thread name, to help with debugging in XCode, gdb, lldb etc... [10.2.9] - 2020-08-19 (ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py [10.2.8] - 2020-08-19 (ws) on Linux with mbedtls, when the system ca certs are specified (the default) pick up sensible OS supplied paths (tested with CentOS and Alpine) [10.2.7] - 2020-08-18 (ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected [10.2.6] - 2020-08-17 (ixwebsocket) replace std::unique_ptr with std::array for some fixed arrays (which are in C++11) [10.2.5] - 2020-08-15 (ws) merge all ws_*.cpp files into a single one to speedup compilation [10.2.4] - 2020-08-15 (socket server) in the loop accepting connections, call select without a timeout on unix to avoid busy looping, and only wake up when a new connection happens [10.2.3] - 2020-08-15 (socket server) instead of busy looping with a sleep, only wake up the GC thread when a new thread will have to be joined, (we know that thanks to the ConnectionState OnSetTerminated callback [10.2.2] - 2020-08-15 (socket server) add a callback to the ConnectionState to be invoked when the connection is terminated. This will be used by the SocketServer in the future to know on time that the associated connection thread can be terminated. [10.2.1] - 2020-08-15 (socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable [10.2.0] - 2020-08-14 (ixwebsocket client) handle HTTP redirects [10.2.0] - 2020-08-13 (ws) upgrade to latest version of nlohmann json (3.9.1 from 3.2.0) [10.1.9] - 2020-08-13 (websocket proxy server) add ability to map different hosts to different websocket servers, using a json config file [10.1.8] - 2020-08-12 (ws) on macOS, with OpenSSL or MbedTLS, use /etc/ssl/cert.pem as the system certs [10.1.7] - 2020-08-11 (ws) -q option imply info log level, not warning log level [10.1.6] - 2020-08-06 (websocket server) Handle programmer error when the server callback is not registered properly (fix #227) [10.1.5] - 2020-08-02 (ws) Add a new ws sub-command, push_server. This command runs a server which sends many messages in a loop to a websocket client. We can receive above 200,000 messages per second (cf #235). [10.1.4] - 2020-08-02 (ws) Add a new ws sub-command, echo_client. This command sends a message to an echo server, and send back to a server whatever message it does receive. When connecting to a local ws echo_server, on my MacBook Pro 2015 I can send/receive around 30,000 messages per second. (cf #235) [10.1.3] - 2020-08-02 (ws) ws echo_server. Add a -q option to only enable warning and error log levels. This is useful for bench-marking so that we do not print a lot of things on the console. (cf #235) [10.1.2] - 2020-07-31 (build) make using zlib optional, with the caveat that some http and websocket features are not available when zlib is absent [10.1.1] - 2020-07-29 (websocket client) onProgressCallback not called for short messages on a websocket (fix #233) [10.1.0] - 2020-07-29 (websocket client) heartbeat is not sent at the requested frequency (fix #232) [10.0.3] - 2020-07-28 compiler warning fixes [10.0.2] - 2020-07-28 (ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting [10.0.1] - 2020-07-27 (socket utility) move ix::getFreePort to ixwebsocket library [10.0.0] - 2020-07-25 (ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr as its first argument [9.10.7] - 2020-07-25 (ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better. [9.10.6] - 2020-07-24 (ws) port broadcast_server sub-command to the new server API [9.10.5] - 2020-07-24 (unittest) port most unittests to the new server API [9.10.3] - 2020-07-24 (ws) port ws transfer to the new server API [9.10.2] - 2020-07-24 (websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor [9.10.1] - 2020-07-24 (websocket server) reset client websocket callback when the connection is closed [9.10.0] - 2020-07-23 (websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did [9.9.3] - 2020-07-17 (build) merge platform specific files which were used to have different implementations for setting a thread name into a single file, to make it easier to include every source files and build the ixwebsocket library (fix #226) [9.9.2] - 2020-07-10 (socket server) bump default max connection count from 32 to 128 [9.9.1] - 2020-07-10 (snake) implement super simple stream sql expression support in snake server [9.9.0] - 2020-07-08 (socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made [9.8.6] - 2020-07-06 (cmake) change the way zlib and openssl are searched [9.8.5] - 2020-07-06 (cobra python bots) remove the test which stop the bot when events do not follow cobra metrics system schema with an id and a device entry [9.8.4] - 2020-06-26 (cobra bots) remove bots which is not required now that we can use Python extensions [9.8.3] - 2020-06-25 (cmake) new python code is optional and enabled at cmake time with -DUSE_PYTHON=1 [9.8.2] - 2020-06-24 (cobra bots) new cobra metrics bot to send data to statsd using Python for processing the message [9.8.1] - 2020-06-19 (cobra metrics to statsd bot) fps slow frame info : do not include os name [9.8.0] - 2020-06-19 (cobra metrics to statsd bot) send info about memory warnings [9.7.9] - 2020-06-18 (http client) fix deadlock when following redirects [9.7.8] - 2020-06-18 (cobra metrics to statsd bot) send info about net requests [9.7.7] - 2020-06-17 (cobra client and bots) add batch_size subscription option for retrieving multiple messages at once [9.7.6] - 2020-06-15 (websocket) WebSocketServer is not a final class, so that users can extend it (fix #215) [9.7.5] - 2020-06-15 (cobra bots) minor aesthetic change, in how we display http headers with a : then space as key value separator instead of :: with no space [9.7.4] - 2020-06-11 (cobra metrics to statsd bot) change from a statsd type of gauge to a timing one [9.7.3] - 2020-06-11 (redis cobra bots) capture most used devices in a zset [9.7.2] - 2020-06-11 (ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise [9.7.1] - 2020-06-11 (redis cobra bots) ws cobra metrics to redis / hostname invalid parsing [9.7.0] - 2020-06-11 (redis cobra bots) xadd with maxlen + fix bug in xadd client implementation and ws cobra metrics to redis command argument parsing [9.6.9] - 2020-06-10 (redis cobra bots) update the cobra to redis bot to use the bot framework, and change it to report fps metrics into redis streams. [9.6.6] - 2020-06-04 (statsd cobra bots) statsd improvement: prefix does not need a dot as a suffix, message size can be larger than 256 bytes, error handling was invalid, use core logger for logging instead of std::cerr [9.6.5] - 2020-05-29 (http server) support gzip compression [9.6.4] - 2020-05-20 (compiler fix) support clang 5 and earlier (contributed by @LunarWatcher) [9.6.3] - 2020-05-18 (cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL [9.6.2] - 2020-05-17 (cmake) make install cmake files optional to not conflict with vcpkg [9.6.1] - 2020-05-17 (windows + tls) mbedtls is the default windows tls backend + add ability to load system certificates with mbdetls on windows [9.6.0] - 2020-05-12 (ixbots) add options to limit how many messages per minute should be processed [9.5.9] - 2020-05-12 (ixbots) add new class to configure a bot to simplify passing options around [9.5.8] - 2020-05-08 (openssl tls) (openssl < 1.1) logic inversion - crypto locking callback are not registered properly [9.5.7] - 2020-05-08 (cmake) default TLS back to mbedtls on Windows Universal Platform [9.5.6] - 2020-05-06 (cobra bots) add a --heartbeat_timeout option to specify when the bot should terminate because no events are received [9.5.5] - 2020-05-06 (openssl tls) when OpenSSL is older than 1.1, register the crypto locking callback to be thread safe. Should fix lots of CI failures [9.5.4] - 2020-05-04 (cobra bots) do not use a queue to store messages pending processing, let the bot handle queuing [9.5.3] - 2020-04-29 (http client) better current request cancellation support when the HttpClient destructor is invoked (see #189) [9.5.2] - 2020-04-27 (cmake) fix cmake broken tls option parsing [9.5.1] - 2020-04-27 (http client) Set default values for most HttpRequestArgs struct members (fix #185) [9.5.0] - 2020-04-25 (ssl) Default to OpenSSL on Windows, since it can load the system certificates by default [9.4.1] - 2020-04-25 (header) Add a space between header name and header value since most http parsers expects it, although it it not required. Cf #184 and #155 [9.4.0] - 2020-04-24 (ssl) Add support for supplying SSL CA from memory, for OpenSSL and MbedTLS backends [9.3.3] - 2020-04-17 (ixbots) display sent/receive message, per seconds as accumulated [9.3.2] - 2020-04-17 (ws) add a --logfile option to configure all logs to go to a file [9.3.1] - 2020-04-16 (cobra bots) add a utility class to factor out the common bots features (heartbeat) and move all bots to used it + convert cobra_subscribe to be a bot and add a unittest for it [9.3.0] - 2020-04-15 (websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent [9.2.9] - 2020-04-15 (ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible [9.2.8] - 2020-04-15 (ixcobra) make CobraConnection_EventType an enum class (CobraEventType) [9.2.7] - 2020-04-14 (ixsentry) add a library method to upload a payload directly to sentry [9.2.6] - 2020-04-14 (ixcobra) snake server / handle invalid incoming json messages + cobra subscriber in fluentd mode insert a created_at timestamp entry [9.2.5] - 2020-04-13 (websocket) WebSocketMessagePtr is a unique_ptr instead of a shared_ptr [9.2.4] - 2020-04-13 (websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations [9.2.3] - 2020-04-13 (ws) add a --runtime option to ws cobra_subscribe to optionally limit how much time it will run [9.2.2] - 2020-04-04 (third_party deps) fix #177, update bundled spdlog to 1.6.0 [9.2.1] - 2020-04-04 (windows) when using OpenSSL, the system store is used to populate the cacert. No need to ship a cacert.pem file with your app. [9.2.0] - 2020-04-04 (windows) ci: windows build with TLS (mbedtls) + verify that we can be build with OpenSSL [9.1.9] - 2020-03-30 (cobra to statsd bot) add ability to extract a numerical value and send a timer event to statsd, with the --timer option [9.1.8] - 2020-03-29 (cobra to statsd bot) bot init was missing + capture socket error [9.1.7] - 2020-03-29 (cobra to statsd bot) add ability to extract a numerical value and send a gauge event to statsd, with the --gauge option [9.1.6] - 2020-03-29 (ws cobra subscriber) use a Json::StreamWriter to write to std::cout, and save one std::string allocation for each message printed [9.1.5] - 2020-03-29 (docker) trim down docker image (300M -> 12M) / binary built without symbol and size optimization, and source code not copied over [9.1.4] - 2020-03-28 (jsoncpp) update bundled copy to version 1.9.3 (at sha 3beb37ea14aec1bdce1a6d542dc464d00f4a6cec) [9.1.3] - 2020-03-27 (docker) alpine docker build with release with debug info, and bundle ca-certificates [9.1.2] - 2020-03-26 (mac ssl) rename DarwinSSL -> SecureTransport (see this too -> https://github.com/curl/curl/issues/3733) [9.1.1] - 2020-03-26 (websocket) fix data race accessing _socket object without mutex protection when calling wakeUpFromPoll in WebSocketTransport.cpp [9.1.0] - 2020-03-26 (ixcobra) add explicit event types for handshake, authentication and subscription failure, and handle those by exiting in ws_cobra_subcribe and friends [9.0.3] - 2020-03-24 (ws connect) display statistics about how much time it takes to stop the connection [9.0.2] - 2020-03-24 (socket) works with unique_ptr instead of shared_ptr in many places [9.0.1] - 2020-03-24 (socket) selectInterrupt member is an unique_ptr instead of being a shared_ptr [9.0.0] - 2020-03-23 (websocket) reset per-message deflate codec everytime we connect to a server/client [8.3.4] - 2020-03-23 (websocket) fix #167, a long standing issue with sending empty messages with per-message deflate extension (and hopefully other zlib bug) [8.3.3] - 2020-03-22 (cobra to statsd) port to windows and add a unittest [8.3.2] - 2020-03-20 (websocket+tls) fix hang in tls handshake which could lead to ANR, discovered through unittesting. [8.3.1] - 2020-03-20 (cobra) CobraMetricsPublisher can be configure with an ix::CobraConfig + more unittest use SSL in server + client [8.3.0] - 2020-03-18 (websocket) Simplify ping/pong based heartbeat implementation [8.2.7] - 2020-03-17 (ws) ws connect gains a new option to set the interval at which to send pings (ws) ws echo_server gains a new option (-p) to disable responding to pings with pongs IXWebSocket$ ws connect --ping_interval 2 wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected [2020-03-17 23:53:02.726] [info] Uri: / [2020-03-17 23:53:02.726] [info] Headers: [2020-03-17 23:53:02.727] [info] Connection: Upgrade [2020-03-17 23:53:02.727] [info] Date: Wed, 18 Mar 2020 06:45:05 GMT [2020-03-17 23:53:02.727] [info] Sec-WebSocket-Accept: 0gtqbxW0aVL/QI/ICpLFnRaiKgA= [2020-03-17 23:53:02.727] [info] sec-websocket-extensions: [2020-03-17 23:53:02.727] [info] Server: Kaazing Gateway [2020-03-17 23:53:02.727] [info] Upgrade: websocket [2020-03-17 23:53:04.894] [info] Received pong [2020-03-17 23:53:06.859] [info] Received pong [2020-03-17 23:53:08.881] [info] Received pong [2020-03-17 23:53:10.848] [info] Received pong [2020-03-17 23:53:12.898] [info] Received pong [2020-03-17 23:53:14.865] [info] Received pong [2020-03-17 23:53:16.890] [info] Received pong [2020-03-17 23:53:18.853] [info] Received pong [2020-03-17 23:53:19.388] [info] ws_connect: connection closed: code 1000 reason Normal closure [2020-03-17 23:53:19.502] [info] Received 208 bytes [2020-03-17 23:53:19.502] [info] Sent 0 bytes [8.2.6] - 2020-03-16 (cobra to sentry bot + docker) default docker file uses mbedtls + ws cobra_to_sentry pass tls options to sentryClient. [8.2.5] - 2020-03-13 (cobra client) ws cobra subscribe resubscribe at latest position after being disconnected [8.2.4] - 2020-03-13 (cobra client) can subscribe with a position [8.2.3] - 2020-03-13 (cobra client) pass the message position to the subscription data callback [8.2.2] - 2020-03-12 (openssl tls backend) Fix a hand in OpenSSL when using TLS v1.3 ... by disabling TLS v1.3 [8.2.1] - 2020-03-11 (cobra) IXCobraConfig struct has tlsOptions and per message deflate options [8.2.0] - 2020-03-11 (cobra) add IXCobraConfig struct to pass cobra config around [8.1.9] - 2020-03-09 (ws cobra_subscribe) add a --fluentd option to wrap a message in an enveloppe so that fluentd can recognize it [8.1.8] - 2020-03-02 (websocket server) fix regression with disabling zlib extension on the server side. If a client does not support this extension the server will handle it fine. We still need to figure out how to disable the option. [8.1.7] - 2020-02-26 (websocket) traffic tracker received bytes is message size while it should be wire size [8.1.6] - 2020-02-26 (ws_connect) display sent/received bytes statistics on exit [8.1.5] - 2020-02-23 (server) give thread name to some usual worker threads / unittest is broken !! [8.1.4] - 2020-02-22 (websocket server) fix regression from 8.1.2, where per-deflate message compression was always disabled [8.1.3] - 2020-02-21 (client + server) Fix #155 / http header parser should treat the space(s) after the : delimiter as optional. Fixing this bug made us discover that websocket sub-protocols are not properly serialiazed, but start with a , [8.1.2] - 2020-02-18 (WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server [8.1.1] - 2020-02-18 (ws cobra to statsd and sentry sender) exit if no messages are received for one minute, which is a sign that something goes wrong on the server side. That should be changed to be configurable in the future [8.1.0] - 2020-02-13 (http client + sentry minidump upload) Multipart stream closing boundary is invalid + mark some options as mandatory in the command line tools [8.0.7] - 2020-02-12 (build) remove the unused subtree which was causing some way of installing to break [8.0.6] - 2020-01-31 (snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections [8.0.5] - 2020-01-31 (IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection [8.0.4] - 2020-01-31 (cobra to sentry) remove noisy logging [8.0.3] - 2020-01-30 (ixcobra) check if we are authenticated in publishNext before trying to publish a message [8.0.2] - 2020-01-28 Extract severity level when emitting messages to sentry [8.0.1] - 2020-01-28 Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry [8.0.0] - 2020-01-26 (SocketServer) add ability to bind on an ipv6 address [7.9.6] - 2020-01-22 (ws) add a dnslookup sub-command, to get the ip address of a remote host [7.9.5] - 2020-01-14 (windows) fix #144, get rid of stubbed/un-implemented windows schannel ssl backend [7.9.4] - 2020-01-12 (openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl [7.9.3] - 2020-01-10 (apple ssl) model write method after the OpenSSL one for consistency [7.9.2] - 2020-01-06 (apple ssl) unify read and write ssl utility code [7.9.1] - 2020-01-06 (websocket client) better error propagation when errors are detected while sending data (ws send) detect failures to send big files, terminate in those cases and report error [7.9.0] - 2020-01-04 (ws send) add option (-x) to disable per message deflate compression [7.8.9] - 2020-01-04 (ws send + receive) handle all message types (ping + pong + fragment) / investigate #140 [7.8.8] - 2019-12-28 (mbedtls) fix related to private key file parsing and initialization [7.8.6] - 2019-12-28 (ws cobra to sentry/statsd) fix for handling null events properly for empty queues + use queue to send data to statsd [7.8.5] - 2019-12-28 (ws cobra to sentry) handle null events for empty queues [7.8.4] - 2019-12-27 (ws cobra to sentry) game is picked in a fair manner, so that all games get the same share of sent events [7.8.3] - 2019-12-27 (ws cobra to sentry) refactor queue related code into a class [7.8.2] - 2019-12-25 (ws cobra to sentry) bound the queue size used to hold up cobra messages before they are sent to sentry. Default queue size is a 100 messages. Without such limit the program runs out of memory when a subscriber receive a lot of messages that cannot make it to sentry [7.8.1] - 2019-12-25 (ws client) use correct compilation defines so that spdlog is not used as a header only library (reduce binary size and increase compilation speed) [7.8.0] - 2019-12-24 (ws client) all commands use spdlog instead of std::cerr or std::cout for logging [7.6.5] - 2019-12-24 (cobra client) send a websocket ping every 30s to keep the connection opened [7.6.4] - 2019-12-22 (client) error handling, quote url in error case when failing to parse one (ws) ws_cobra_publish: register callbacks before connecting (doc) mention mbedtls in supported ssl server backend [7.6.3] - 2019-12-20 (tls) add a simple description of the TLS configuration routine for debugging [7.6.2] - 2019-12-20 (mbedtls) correct support for using own certificate and private key [7.6.1] - 2019-12-20 (ws commands) in websocket proxy, disable automatic reconnections + in Dockerfile, use alpine 3.11 [7.6.0] - 2019-12-19 (cobra) Add TLS options to all cobra commands and classes. Add example to the doc. [7.5.8] - 2019-12-18 (cobra-to-sentry) capture application version from device field [7.5.7] - 2019-12-18 (tls) Experimental TLS server support with mbedtls (windows) + process cert tlsoption (client + server) [7.5.6] - 2019-12-18 (tls servers) Make it clear that apple ssl and mbedtls backends do not support SSL in server mode [7.5.5] - 2019-12-17 (tls options client) TLSOptions struct _validated member should be initialized to false [7.5.4] - 2019-12-16 (websocket client) improve the error message when connecting to a non websocket server Before: Connection error: Got bad status connecting to example.com:443, status: 200, HTTP Status line: HTTP/1.1 200 OK After: Connection error: Expecting status 101 (Switching Protocol), got 200 status connecting to example.com:443, HTTP Status line: HTTP/1.1 200 OK [7.5.3] - 2019-12-12 (server) attempt at fixing #131 by using blocking writes in server mode [7.5.2] - 2019-12-11 (ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages [7.5.1] - 2019-12-06 (mac) convert SSL errors to utf8 [7.5.0] - 2019-12-05 (ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry. In the example below sentry we are sending data too fast, sentry asks us to slow down which we do. Notice how the sent count stop increasing, while we are waiting for 41 seconds. [2019-12-05 15:50:33.759] [info] messages received 2449 sent 3 [2019-12-05 15:50:34.759] [info] messages received 5533 sent 7 [2019-12-05 15:50:35.759] [info] messages received 8612 sent 11 [2019-12-05 15:50:36.759] [info] messages received 11562 sent 15 [2019-12-05 15:50:37.759] [info] messages received 14410 sent 19 [2019-12-05 15:50:38.759] [info] messages received 17236 sent 23 [2019-12-05 15:50:39.282] [error] Error sending data to sentry: 429 [2019-12-05 15:50:39.282] [error] Body: {\"exception\":[{\"stacktrace\":{\"frames\":[{\"filename\":\"WorldScene.lua\",\"function\":\"WorldScene.lua:1935\",\"lineno\":1958},{\"filename\":\"WorldScene.lua\",\"function\":\"onUpdate_WorldCam\",\"lineno\":1921},{\"filename\":\"WorldMapTile.lua\",\"function\":\"__index\",\"lineno\":239}]},\"value\":\"noisytypes: Attempt to call nil(nil,2224139838)!\"}],\"platform\":\"python\",\"sdk\":{\"name\":\"ws\",\"version\":\"1.0.0\"},\"tags\":[[\"game\",\"niso\"],[\"userid\",\"107638363\"],[\"environment\",\"live\"]],\"timestamp\":\"2019-12-05T23:50:39Z\"} [2019-12-05 15:50:39.282] [error] Response: {\"error_name\":\"rate_limit\",\"error\":\"Creation of this event was denied due to rate limiting\"} [2019-12-05 15:50:39.282] [warning] Error 429 - Too Many Requests. ws will sleep and retry after 41 seconds [2019-12-05 15:50:39.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:40.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:41.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:42.761] [info] messages received 18839 sent 25 [2019-12-05 15:50:43.762] [info] messages received 18839 sent 25 [2019-12-05 15:50:44.763] [info] messages received 18839 sent 25 [2019-12-05 15:50:45.768] [info] messages received 18839 sent 25 [7.4.5] - 2019-12-03 (ws) #125 / fix build problem when jsoncpp is not installed locally [7.4.4] - 2019-12-03 (ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present [7.4.3] - 2019-12-03 (http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases [7.4.2] - 2019-12-02 (client) internal IXDNSLookup class requires a valid cancellation request function callback to be passed in [7.4.1] - 2019-12-02 (client) fix an overflow in the exponential back off code [7.4.0] - 2019-11-25 (http client) Add support for multipart HTTP POST upload (ixsentry) Add support for uploading a minidump to sentry [7.3.5] - 2019-11-20 On Darwin SSL, add ability to skip peer verification. [7.3.4] - 2019-11-20 32-bits compile fix, courtesy of @fcojavmc [7.3.1] - 2019-11-16 ws proxy_server / remote server close not forwarded to the client [7.3.0] - 2019-11-15 New ws command: ws proxy_server . [7.2.2] - 2019-11-01 Tag a release + minor reformating. [7.2.1] - 2019-10-26 Add unittest to IXSentryClient to lua backtrace parsing code [7.2.0] - 2019-10-24 Add cobra_metrics_to_redis sub-command to create streams for each cobra metric event being received. [7.1.0] - 2019-10-13 Add client support for websocket subprotocol. Look for the new addSubProtocol method for details. [7.0.0] - 2019-10-01 TLS support in server code, only implemented for the OpenSSL SSL backend for now. [6.3.4] - 2019-09-30 all ws subcommands propagate tls options to servers (unimplemented) or ws or http client (implemented) (contributed by Matt DeBoer) [6.3.3] - 2019-09-30 ws has a --version option [6.3.2] - 2019-09-29 (http + websocket clients) can specify cacert and some other tls options (not implemented on all backend). This makes it so that server certs can finally be validated on windows. [6.3.1] - 2019-09-29 Add ability to use OpenSSL on apple platforms. [6.3.0] - 2019-09-28 ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher [6.2.9] - 2019-09-27 mbedtls fixes / the unittest now pass on macOS, and hopefully will on Windows/AppVeyor as well. [6.2.8] - 2019-09-26 Http server: add options to ws https to redirect all requests to a given url. POST requests will get a 200 and an empty response. ws httpd -L --redirect_url https://www.google.com [6.2.7] - 2019-09-25 Stop having ws send subcommand send a binary message in text mode, which would cause error in make ws_test shell script test. [6.2.6] - 2019-09-24 Fix 2 race conditions detected with TSan, one in CobraMetricsPublisher::push and another one in WebSocketTransport::sendData (that one was bad). [6.2.5] - 2019-09-23 Add simple Redis Server which is only capable of doing publish / subscribe. New ws redis_server sub-command to use it. The server is used in the unittest, so that we can run on CI in environment where redis isn not available like github actions env. [6.2.4] - 2019-09-22 Add options to configure TLS ; contributed by Matt DeBoer. Only implemented for OpenSSL TLS backend for now. [6.2.3] - 2019-09-21 Fix crash in the Linux unittest in the HTTP client code, in Socket::readBytes Cobra Metrics Publisher code returns the message id of the message that got published, to be used to validated that it got sent properly when receiving an ack. [6.2.2] - 2019-09-19 In DNS lookup code, make sure the weak pointer we use lives through the expected scope (if branch) [6.2.1] - 2019-09-17 On error while doing a client handshake, additionally display port number next to the host name [6.2.0] - 2019-09-09 websocket and http server: server does not close the bound client socket in many cases improve some websocket error messages add a utility function with unittest to parse status line and stop using scanf which triggers warnings on Windows update ws CLI11 (our command line argument parsing library) to the latest, which fix a compiler bug about optional [6.1.0] - 2019-09-08 move poll wrapper on top of select (only used on Windows) to the ix namespace [6.0.1] - 2019-09-05 add cobra metrics publisher + server unittest add cobra client + server unittest ws snake (cobra simple server) add basic support for unsubscription + subscribe send the proper subscription data + redis client subscription can be cancelled IXCobraConnection / pdu handlers can crash if they receive json data which is not an object [6.0.0] - 2019-09-04 all client autobahn test should pass ! zlib/deflate has a bug with windowsbits == 8, so we silently upgrade it to 9/ (fix autobahn test 13.X which uses 8 for the windows size) [5.2.0] - 2019-09-04 Fragmentation: for sent messages which are compressed, the continuation fragments should not have the rsv1 bit set (fix all autobahn tests for zlib compression 12.X) Websocket Server / do a case insensitive string search when looking for an Upgrade header whose value is websocket. (some client use WebSocket with some upper-case characters) [5.1.9] - 2019-09-03 ws autobahn / report progress with spdlog::info to get timing info ws autobahn / use condition variables for stopping test case + add more logging on errors [5.1.8] - 2019-09-03 Per message deflate/compression: handle fragmented messages (fix autobahn test: 12.1.X and probably others) [5.1.7] - 2019-09-03 Receiving invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) [5.1.6] - 2019-09-03 Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead. Validate that the reason is proper utf-8. (fix autobahn test 7.5.1) Validate close codes. Autobahn 7.9.* [5.1.5] - 2019-09-03 Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation) [5.1.4] - 2019-09-03 Sending invalid UTF-8 TEXT message should fail and close the connection (fix tons of autobahn test: 6.X UTF-8 Handling) [5.1.3] - 2019-09-03 Message type (TEXT or BINARY) is invalid for received fragmented messages (fix autobahn test: 5.3 through 5.8 Fragmentation) [5.1.2] - 2019-09-02 Ping and Pong messages cannot be fragmented (fix autobahn test: 5.1 and 5.2 Fragmentation) [5.1.1] - 2019-09-01 Close connections when reserved bits are used (fix autobahn test: 3.X Reserved Bits) [5.1.0] - 2019-08-31 ws autobahn / Add code to test websocket client compliance with the autobahn test-suite add utf-8 validation code, not hooked up properly yet Ping received with a payload too large (> 125 bytes) trigger a connection closure cobra / add tracking about published messages cobra / publish returns a message id, that can be used when cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system). [5.0.9] - 2019-08-30 User-Agent header is set when not specified. New option to cap the max wait between reconnection attempts. Still default to 10s. (setMaxWaitBetweenReconnectionRetries). ws connect --max_wait 5000 ws://example.com # will only wait 5 seconds max between reconnection attempts [5.0.7] - 2019-08-23 WebSocket: add new option to pass in extra HTTP headers when connecting. ws connect add new option (-H, works like curl ) to pass in extra HTTP headers when connecting If you run against ws echo_server you will see the headers being received printed in the terminal. ws connect -H \"foo: bar\" -H \"baz: buz\" ws://127.0.0.1:8008 CobraConnection: sets a unique id field for all messages sent to cobra . CobraConnection: sets a counter as a field for each event published. [5.0.6] - 2019-08-22 Windows: silly compile error (poll should be in the global namespace) [5.0.5] - 2019-08-22 Windows: use select instead of WSAPoll, through a poll wrapper [5.0.4] - 2019-08-20 Windows build fixes (there was a problem with the use of ::poll that has a different name on Windows (WSAPoll)) [5.0.3] - 2019-08-14 CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default [5.0.2] - 2019-08-01 ws cobra_subscribe has a new -q (quiet) option ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) ws cobra_subscribe, cobra_to_statsd and cobra_to_sentry commands have a new option, --filter to restrict the events they want to receive [5.0.1] - 2019-07-25 ws connect command has a new option to send in binary mode (still default to text) ws connect command has readline history thanks to libnoise-cpp. Now ws connect one can use using arrows to lookup previous sent messages and edit them [5.0.0] - 2019-06-23 Changed New HTTP server / still very early. ws gained a new command, httpd can run a simple webserver serving local files. IXDNSLookup. Uses weak pointer + smart_ptr + shared_from_this instead of static sets + mutex to handle object going away before dns lookup has resolved cobra_to_sentry / backtraces are reversed and line number is not extracted correctly mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found travis CI uses g++ on Linux [4.0.0] - 2019-06-09 Changed WebSocket::send() sends message in TEXT mode by default WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text WebSocket::send takes a third arg, binary which default to true (can be text too) WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg Add explicit WebSocket::sendBinary method New headers + WebSocketMessage class to hold message data, still not used across the board Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility. ws echo_server has a -g option to print a greeting message on connect IXSocketMbedTLS: better error handling in close and connect [3.1.2] - 2019-06-06 Added ws connect has a -x option to disable per message deflate Add WebSocket::disablePerMessageDeflate() option. [3.0.0] - 2019-06-xx Changed TLS, aka SSL works on Windows (websocket and http clients) ws command line tool build on Windows Async API for HttpClient HttpClient API changed to use shared_ptr for response and request","title":"Changelog"},{"location":"CHANGELOG/#changelog","text":"All changes to this project will be documented in this file.","title":"Changelog"},{"location":"CHANGELOG/#1145-2024-06-05","text":"New changes are documented in the Release page in the GitHub repository.","title":"[11.4.5] - 2024-06-05"},{"location":"CHANGELOG/#1144-2023-06-05","text":"","title":"[11.4.4] - 2023-06-05"},{"location":"CHANGELOG/#1143-2022-05-13","text":"Set shorter thread names BoringSSL fix with SNI Websocket computed header is valid Base64","title":"[11.4.3] - 2022-05-13"},{"location":"CHANGELOG/#1141-2022-04-23","text":"vckpg + cmake fix, to handle zlib as a dependency better","title":"[11.4.1] - 2022-04-23"},{"location":"CHANGELOG/#1140-2022-01-05","text":"(Windows) Use wsa select event, which should lead to a much better behavior on Windows in general, and also when sending large payloads (#342) Fix \"HTTP/1.1 400 Illegal character CNTL=0xf\" caused by serverMaxWindowBits/clientMaxWindowBits being uint8_t (signed char). (#341) Export symbols into .def files Export symbols into .def files on MSVC (#339) Include to provide standard error constants (#338) Improved compatibility - fix mingw crossbuild (#337) Allow to cancel asynchronous HTTP requests (#332) Fix errors in example code. (#336)","title":"[11.4.0] - 2022-01-05"},{"location":"CHANGELOG/#1132-2021-11-24","text":"(server) Add getters for basic Servers properties (like port, host, etc...) (#327) + fix one compiler warning","title":"[11.3.2] - 2021-11-24"},{"location":"CHANGELOG/#1131-2021-10-22","text":"(library/cmake) Compatible with MbedTLS 3 + fix a bug on Windows where the incorrect remote port is computed (#320)","title":"[11.3.1] - 2021-10-22"},{"location":"CHANGELOG/#1130-2021-09-20","text":"(library/cmake) Only find OpenSSL, MbedTLS, zlib if they have not already been found, make CMake install optional (#317) + Use GNUInstallDirs in cmake (#318)","title":"[11.3.0] - 2021-09-20"},{"location":"CHANGELOG/#11210-2021-07-27","text":"(ws) bump CLI command line parsing library from 1.8 to 2.0","title":"[11.2.10] - 2021-07-27"},{"location":"CHANGELOG/#1129-2021-06-08","text":"(ws) ws connect has a -g option to gzip decompress messages for API such as the websocket Huobi Global.","title":"[11.2.9] - 2021-06-08"},{"location":"CHANGELOG/#1128-2021-06-03","text":"(websocket client + server) WebSocketMessage class tweak to fix unsafe patterns","title":"[11.2.8] - 2021-06-03"},{"location":"CHANGELOG/#1127-2021-05-27","text":"(websocket server) Handle and accept firefox browser special upgrade value (keep-alive, Upgrade)","title":"[11.2.7] - 2021-05-27"},{"location":"CHANGELOG/#1126-2021-05-18","text":"(Windows) move EINVAL (re)definition from IXSocket.h to IXNetSystem.h (fix #289)","title":"[11.2.6] - 2021-05-18"},{"location":"CHANGELOG/#1125-2021-04-04","text":"(http client) DEL is not an HTTP method name, but DELETE is","title":"[11.2.5] - 2021-04-04"},{"location":"CHANGELOG/#1124-2021-03-25","text":"(cmake) install IXUniquePtr.h","title":"[11.2.4] - 2021-03-25"},{"location":"CHANGELOG/#1123-2021-03-24","text":"(ssl + windows) missing include for CertOpenStore function","title":"[11.2.3] - 2021-03-24"},{"location":"CHANGELOG/#1122-2021-03-23","text":"(ixwebsocket) version bump","title":"[11.2.2] - 2021-03-23"},{"location":"CHANGELOG/#1121-2021-03-23","text":"(ixwebsocket) version bump","title":"[11.2.1] - 2021-03-23"},{"location":"CHANGELOG/#1120-2021-03-23","text":"(ixwebsocket) correct mingw support (gcc on windows)","title":"[11.2.0] - 2021-03-23"},{"location":"CHANGELOG/#1114-2021-03-23","text":"(ixwebsocket) add getMinWaitBetweenReconnectionRetries","title":"[11.1.4] - 2021-03-23"},{"location":"CHANGELOG/#1113-2021-03-23","text":"(ixwebsocket) New option to set the min wait between reconnection attempts. Still default to 1ms. (setMinWaitBetweenReconnectionRetries).","title":"[11.1.3] - 2021-03-23"},{"location":"CHANGELOG/#1112-2021-03-22","text":"(ws) initialize maxWaitBetweenReconnectionRetries to a non zero value ; a zero value was causing spurious reconnections attempts","title":"[11.1.2] - 2021-03-22"},{"location":"CHANGELOG/#1111-2021-03-20","text":"(cmake) Library can be built as a static or a dynamic library, controlled with BUILD_SHARED_LIBS. Default to static library","title":"[11.1.1] - 2021-03-20"},{"location":"CHANGELOG/#1110-2021-03-16","text":"(ixwebsocket) Use LEAN_AND_MEAN Windows define to help with undefined link error when building a DLL. Support websocket server disablePerMessageDeflate option correctly.","title":"[11.1.0] - 2021-03-16"},{"location":"CHANGELOG/#1109-2021-03-07","text":"(ixwebsocket) Expose setHandshakeTimeout method","title":"[11.0.9] - 2021-03-07"},{"location":"CHANGELOG/#1108-2020-12-25","text":"(ws) trim ws dependencies no more ixcrypto and ixcore deps","title":"[11.0.8] - 2020-12-25"},{"location":"CHANGELOG/#1107-2020-12-25","text":"(ws) trim ws dependencies, only depends on ixcrypto and ixcore","title":"[11.0.7] - 2020-12-25"},{"location":"CHANGELOG/#1106-2020-12-22","text":"(build) rename makefile to makefile.dev to ease cmake BuildExternal (fix #261)","title":"[11.0.6] - 2020-12-22"},{"location":"CHANGELOG/#1105-2020-12-17","text":"(ws) Implement simple header based websocket authorization technique to reject client which do not supply a certain header (\"Authorization\") with a special value (see doc).","title":"[11.0.5] - 2020-12-17"},{"location":"CHANGELOG/#1104-2020-11-16","text":"(ixwebsocket) Handle EINTR return code in ix::poll and IXSelectInterrupt","title":"[11.0.4] - 2020-11-16"},{"location":"CHANGELOG/#1103-2020-11-16","text":"(ixwebsocket) Fix #252 / regression in 11.0.2 with string comparisons","title":"[11.0.3] - 2020-11-16"},{"location":"CHANGELOG/#1102-2020-11-15","text":"(ixwebsocket) use a C++11 compatible make_unique shim","title":"[11.0.2] - 2020-11-15"},{"location":"CHANGELOG/#1101-2020-11-11","text":"(socket) replace a std::vector with an std::array used as a tmp buffer in Socket::readBytes","title":"[11.0.1] - 2020-11-11"},{"location":"CHANGELOG/#1100-2020-11-11","text":"(openssl security fix) in the client to server connection, peer verification is not done in all cases. See https://github.com/machinezone/IXWebSocket/pull/250","title":"[11.0.0] - 2020-11-11"},{"location":"CHANGELOG/#1057-2020-11-07","text":"(docker) build docker container with zlib disabled","title":"[10.5.7] - 2020-11-07"},{"location":"CHANGELOG/#1056-2020-11-07","text":"(cmake) DEFLATE -> Deflate in CMake to stop warnings about casing","title":"[10.5.6] - 2020-11-07"},{"location":"CHANGELOG/#1055-2020-11-07","text":"(ws autoroute) Display result in compliant way (AUTOROUTE IXWebSocket :: N ms) so that result can be parsed easily","title":"[10.5.5] - 2020-11-07"},{"location":"CHANGELOG/#1054-2020-10-30","text":"(ws gunzip + IXGZipCodec) Can decompress gziped data with libdeflate. ws gunzip computed output filename was incorrect (was the extension aka gz) instead of the file without the extension. Also check whether the output file is writeable.","title":"[10.5.4] - 2020-10-30"},{"location":"CHANGELOG/#1053-2020-10-19","text":"(http code) With zlib disabled, some code should not be reached","title":"[10.5.3] - 2020-10-19"},{"location":"CHANGELOG/#1052-2020-10-12","text":"(ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb","title":"[10.5.2] - 2020-10-12"},{"location":"CHANGELOG/#1051-2020-10-09","text":"(http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present.","title":"[10.5.1] - 2020-10-09"},{"location":"CHANGELOG/#1050-2020-09-30","text":"(http client + server + ws) Add support for uploading files with ws -F foo=@filename, new -D http server option to debug incoming client requests, internal api changed for http POST, PUT and PATCH to supply an HttpFormDataParameters","title":"[10.5.0] - 2020-09-30"},{"location":"CHANGELOG/#1049-2020-09-30","text":"(http server + utility code) Add support for doing gzip compression with libdeflate library, if available","title":"[10.4.9] - 2020-09-30"},{"location":"CHANGELOG/#1048-2020-09-30","text":"(cmake) Stop using FetchContent cmake module to retrieve jsoncpp third party dependency","title":"[10.4.8] - 2020-09-30"},{"location":"CHANGELOG/#1047-2020-09-28","text":"(ws) add gzip and gunzip ws sub commands","title":"[10.4.7] - 2020-09-28"},{"location":"CHANGELOG/#1046-2020-09-26","text":"(cmake) use FetchContent cmake module to retrieve jsoncpp third party dependency","title":"[10.4.6] - 2020-09-26"},{"location":"CHANGELOG/#1045-2020-09-26","text":"(cmake) use FetchContent cmake module to retrieve spdlog third party dependency","title":"[10.4.5] - 2020-09-26"},{"location":"CHANGELOG/#1044-2020-09-22","text":"(cobra connection) retrieve cobra server connection id from the cobra handshake message and display it in ws clients, metrics publisher and bots","title":"[10.4.4] - 2020-09-22"},{"location":"CHANGELOG/#1043-2020-09-22","text":"(cobra 2 cobra) specify as an HTTP header which channel we will republish to","title":"[10.4.3] - 2020-09-22"},{"location":"CHANGELOG/#1042-2020-09-18","text":"(cobra bots) change an error log to a warning log when reconnecting because no messages were received for a minute","title":"[10.4.2] - 2020-09-18"},{"location":"CHANGELOG/#1041-2020-09-18","text":"(cobra connection and bots) set an HTTP header when connecting to help with debugging bots","title":"[10.4.1] - 2020-09-18"},{"location":"CHANGELOG/#1040-2020-09-12","text":"(http server) read body request when the Content-Length is specified + set timeout to read the request to 30 seconds max by default, and make it configurable as a constructor parameter","title":"[10.4.0] - 2020-09-12"},{"location":"CHANGELOG/#1035-2020-09-09","text":"(ws) autoroute command exit on its own once all messages have been received","title":"[10.3.5] - 2020-09-09"},{"location":"CHANGELOG/#1034-2020-09-04","text":"(docker) ws docker file installs strace","title":"[10.3.4] - 2020-09-04"},{"location":"CHANGELOG/#1033-2020-09-02","text":"(ws) echo_client command renamed to autoroute. Command exit once the server close the connection. push_server commands exit once N messages have been sent.","title":"[10.3.3] - 2020-09-02"},{"location":"CHANGELOG/#1032-2020-08-31","text":"(ws + cobra bots) add a cobra_to_cobra ws subcommand to subscribe to a channel and republish received events to a different channel","title":"[10.3.2] - 2020-08-31"},{"location":"CHANGELOG/#1031-2020-08-28","text":"(socket servers) merge the ConnectionInfo class with the ConnectionState one, which simplify all the server apis","title":"[10.3.1] - 2020-08-28"},{"location":"CHANGELOG/#1030-2020-08-26","text":"(ws) set the main thread name, to help with debugging in XCode, gdb, lldb etc...","title":"[10.3.0] - 2020-08-26"},{"location":"CHANGELOG/#1029-2020-08-19","text":"(ws) cobra to python bot / take a module python name as argument foo.bar.baz instead of a path foo/bar/baz.py","title":"[10.2.9] - 2020-08-19"},{"location":"CHANGELOG/#1028-2020-08-19","text":"(ws) on Linux with mbedtls, when the system ca certs are specified (the default) pick up sensible OS supplied paths (tested with CentOS and Alpine)","title":"[10.2.8] - 2020-08-19"},{"location":"CHANGELOG/#1027-2020-08-18","text":"(ws push_server) on the server side, stop sending and close the connection when the remote end has disconnected","title":"[10.2.7] - 2020-08-18"},{"location":"CHANGELOG/#1026-2020-08-17","text":"(ixwebsocket) replace std::unique_ptr with std::array for some fixed arrays (which are in C++11)","title":"[10.2.6] - 2020-08-17"},{"location":"CHANGELOG/#1025-2020-08-15","text":"(ws) merge all ws_*.cpp files into a single one to speedup compilation","title":"[10.2.5] - 2020-08-15"},{"location":"CHANGELOG/#1024-2020-08-15","text":"(socket server) in the loop accepting connections, call select without a timeout on unix to avoid busy looping, and only wake up when a new connection happens","title":"[10.2.4] - 2020-08-15"},{"location":"CHANGELOG/#1023-2020-08-15","text":"(socket server) instead of busy looping with a sleep, only wake up the GC thread when a new thread will have to be joined, (we know that thanks to the ConnectionState OnSetTerminated callback","title":"[10.2.3] - 2020-08-15"},{"location":"CHANGELOG/#1022-2020-08-15","text":"(socket server) add a callback to the ConnectionState to be invoked when the connection is terminated. This will be used by the SocketServer in the future to know on time that the associated connection thread can be terminated.","title":"[10.2.2] - 2020-08-15"},{"location":"CHANGELOG/#1021-2020-08-15","text":"(socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable","title":"[10.2.1] - 2020-08-15"},{"location":"CHANGELOG/#1020-2020-08-14","text":"(ixwebsocket client) handle HTTP redirects","title":"[10.2.0] - 2020-08-14"},{"location":"CHANGELOG/#1020-2020-08-13","text":"(ws) upgrade to latest version of nlohmann json (3.9.1 from 3.2.0)","title":"[10.2.0] - 2020-08-13"},{"location":"CHANGELOG/#1019-2020-08-13","text":"(websocket proxy server) add ability to map different hosts to different websocket servers, using a json config file","title":"[10.1.9] - 2020-08-13"},{"location":"CHANGELOG/#1018-2020-08-12","text":"(ws) on macOS, with OpenSSL or MbedTLS, use /etc/ssl/cert.pem as the system certs","title":"[10.1.8] - 2020-08-12"},{"location":"CHANGELOG/#1017-2020-08-11","text":"(ws) -q option imply info log level, not warning log level","title":"[10.1.7] - 2020-08-11"},{"location":"CHANGELOG/#1016-2020-08-06","text":"(websocket server) Handle programmer error when the server callback is not registered properly (fix #227)","title":"[10.1.6] - 2020-08-06"},{"location":"CHANGELOG/#1015-2020-08-02","text":"(ws) Add a new ws sub-command, push_server. This command runs a server which sends many messages in a loop to a websocket client. We can receive above 200,000 messages per second (cf #235).","title":"[10.1.5] - 2020-08-02"},{"location":"CHANGELOG/#1014-2020-08-02","text":"(ws) Add a new ws sub-command, echo_client. This command sends a message to an echo server, and send back to a server whatever message it does receive. When connecting to a local ws echo_server, on my MacBook Pro 2015 I can send/receive around 30,000 messages per second. (cf #235)","title":"[10.1.4] - 2020-08-02"},{"location":"CHANGELOG/#1013-2020-08-02","text":"(ws) ws echo_server. Add a -q option to only enable warning and error log levels. This is useful for bench-marking so that we do not print a lot of things on the console. (cf #235)","title":"[10.1.3] - 2020-08-02"},{"location":"CHANGELOG/#1012-2020-07-31","text":"(build) make using zlib optional, with the caveat that some http and websocket features are not available when zlib is absent","title":"[10.1.2] - 2020-07-31"},{"location":"CHANGELOG/#1011-2020-07-29","text":"(websocket client) onProgressCallback not called for short messages on a websocket (fix #233)","title":"[10.1.1] - 2020-07-29"},{"location":"CHANGELOG/#1010-2020-07-29","text":"(websocket client) heartbeat is not sent at the requested frequency (fix #232)","title":"[10.1.0] - 2020-07-29"},{"location":"CHANGELOG/#1003-2020-07-28","text":"compiler warning fixes","title":"[10.0.3] - 2020-07-28"},{"location":"CHANGELOG/#1002-2020-07-28","text":"(ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting","title":"[10.0.2] - 2020-07-28"},{"location":"CHANGELOG/#1001-2020-07-27","text":"(socket utility) move ix::getFreePort to ixwebsocket library","title":"[10.0.1] - 2020-07-27"},{"location":"CHANGELOG/#1000-2020-07-25","text":"(ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr as its first argument","title":"[10.0.0] - 2020-07-25"},{"location":"CHANGELOG/#9107-2020-07-25","text":"(ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better.","title":"[9.10.7] - 2020-07-25"},{"location":"CHANGELOG/#9106-2020-07-24","text":"(ws) port broadcast_server sub-command to the new server API","title":"[9.10.6] - 2020-07-24"},{"location":"CHANGELOG/#9105-2020-07-24","text":"(unittest) port most unittests to the new server API","title":"[9.10.5] - 2020-07-24"},{"location":"CHANGELOG/#9103-2020-07-24","text":"(ws) port ws transfer to the new server API","title":"[9.10.3] - 2020-07-24"},{"location":"CHANGELOG/#9102-2020-07-24","text":"(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor","title":"[9.10.2] - 2020-07-24"},{"location":"CHANGELOG/#9101-2020-07-24","text":"(websocket server) reset client websocket callback when the connection is closed","title":"[9.10.1] - 2020-07-24"},{"location":"CHANGELOG/#9100-2020-07-23","text":"(websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did","title":"[9.10.0] - 2020-07-23"},{"location":"CHANGELOG/#993-2020-07-17","text":"(build) merge platform specific files which were used to have different implementations for setting a thread name into a single file, to make it easier to include every source files and build the ixwebsocket library (fix #226)","title":"[9.9.3] - 2020-07-17"},{"location":"CHANGELOG/#992-2020-07-10","text":"(socket server) bump default max connection count from 32 to 128","title":"[9.9.2] - 2020-07-10"},{"location":"CHANGELOG/#991-2020-07-10","text":"(snake) implement super simple stream sql expression support in snake server","title":"[9.9.1] - 2020-07-10"},{"location":"CHANGELOG/#990-2020-07-08","text":"(socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made","title":"[9.9.0] - 2020-07-08"},{"location":"CHANGELOG/#986-2020-07-06","text":"(cmake) change the way zlib and openssl are searched","title":"[9.8.6] - 2020-07-06"},{"location":"CHANGELOG/#985-2020-07-06","text":"(cobra python bots) remove the test which stop the bot when events do not follow cobra metrics system schema with an id and a device entry","title":"[9.8.5] - 2020-07-06"},{"location":"CHANGELOG/#984-2020-06-26","text":"(cobra bots) remove bots which is not required now that we can use Python extensions","title":"[9.8.4] - 2020-06-26"},{"location":"CHANGELOG/#983-2020-06-25","text":"(cmake) new python code is optional and enabled at cmake time with -DUSE_PYTHON=1","title":"[9.8.3] - 2020-06-25"},{"location":"CHANGELOG/#982-2020-06-24","text":"(cobra bots) new cobra metrics bot to send data to statsd using Python for processing the message","title":"[9.8.2] - 2020-06-24"},{"location":"CHANGELOG/#981-2020-06-19","text":"(cobra metrics to statsd bot) fps slow frame info : do not include os name","title":"[9.8.1] - 2020-06-19"},{"location":"CHANGELOG/#980-2020-06-19","text":"(cobra metrics to statsd bot) send info about memory warnings","title":"[9.8.0] - 2020-06-19"},{"location":"CHANGELOG/#979-2020-06-18","text":"(http client) fix deadlock when following redirects","title":"[9.7.9] - 2020-06-18"},{"location":"CHANGELOG/#978-2020-06-18","text":"(cobra metrics to statsd bot) send info about net requests","title":"[9.7.8] - 2020-06-18"},{"location":"CHANGELOG/#977-2020-06-17","text":"(cobra client and bots) add batch_size subscription option for retrieving multiple messages at once","title":"[9.7.7] - 2020-06-17"},{"location":"CHANGELOG/#976-2020-06-15","text":"(websocket) WebSocketServer is not a final class, so that users can extend it (fix #215)","title":"[9.7.6] - 2020-06-15"},{"location":"CHANGELOG/#975-2020-06-15","text":"(cobra bots) minor aesthetic change, in how we display http headers with a : then space as key value separator instead of :: with no space","title":"[9.7.5] - 2020-06-15"},{"location":"CHANGELOG/#974-2020-06-11","text":"(cobra metrics to statsd bot) change from a statsd type of gauge to a timing one","title":"[9.7.4] - 2020-06-11"},{"location":"CHANGELOG/#973-2020-06-11","text":"(redis cobra bots) capture most used devices in a zset","title":"[9.7.3] - 2020-06-11"},{"location":"CHANGELOG/#972-2020-06-11","text":"(ws) add bare bone redis-cli like sub-command, with command line editing powered by libnoise","title":"[9.7.2] - 2020-06-11"},{"location":"CHANGELOG/#971-2020-06-11","text":"(redis cobra bots) ws cobra metrics to redis / hostname invalid parsing","title":"[9.7.1] - 2020-06-11"},{"location":"CHANGELOG/#970-2020-06-11","text":"(redis cobra bots) xadd with maxlen + fix bug in xadd client implementation and ws cobra metrics to redis command argument parsing","title":"[9.7.0] - 2020-06-11"},{"location":"CHANGELOG/#969-2020-06-10","text":"(redis cobra bots) update the cobra to redis bot to use the bot framework, and change it to report fps metrics into redis streams.","title":"[9.6.9] - 2020-06-10"},{"location":"CHANGELOG/#966-2020-06-04","text":"(statsd cobra bots) statsd improvement: prefix does not need a dot as a suffix, message size can be larger than 256 bytes, error handling was invalid, use core logger for logging instead of std::cerr","title":"[9.6.6] - 2020-06-04"},{"location":"CHANGELOG/#965-2020-05-29","text":"(http server) support gzip compression","title":"[9.6.5] - 2020-05-29"},{"location":"CHANGELOG/#964-2020-05-20","text":"(compiler fix) support clang 5 and earlier (contributed by @LunarWatcher)","title":"[9.6.4] - 2020-05-20"},{"location":"CHANGELOG/#963-2020-05-18","text":"(cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL","title":"[9.6.3] - 2020-05-18"},{"location":"CHANGELOG/#962-2020-05-17","text":"(cmake) make install cmake files optional to not conflict with vcpkg","title":"[9.6.2] - 2020-05-17"},{"location":"CHANGELOG/#961-2020-05-17","text":"(windows + tls) mbedtls is the default windows tls backend + add ability to load system certificates with mbdetls on windows","title":"[9.6.1] - 2020-05-17"},{"location":"CHANGELOG/#960-2020-05-12","text":"(ixbots) add options to limit how many messages per minute should be processed","title":"[9.6.0] - 2020-05-12"},{"location":"CHANGELOG/#959-2020-05-12","text":"(ixbots) add new class to configure a bot to simplify passing options around","title":"[9.5.9] - 2020-05-12"},{"location":"CHANGELOG/#958-2020-05-08","text":"(openssl tls) (openssl < 1.1) logic inversion - crypto locking callback are not registered properly","title":"[9.5.8] - 2020-05-08"},{"location":"CHANGELOG/#957-2020-05-08","text":"(cmake) default TLS back to mbedtls on Windows Universal Platform","title":"[9.5.7] - 2020-05-08"},{"location":"CHANGELOG/#956-2020-05-06","text":"(cobra bots) add a --heartbeat_timeout option to specify when the bot should terminate because no events are received","title":"[9.5.6] - 2020-05-06"},{"location":"CHANGELOG/#955-2020-05-06","text":"(openssl tls) when OpenSSL is older than 1.1, register the crypto locking callback to be thread safe. Should fix lots of CI failures","title":"[9.5.5] - 2020-05-06"},{"location":"CHANGELOG/#954-2020-05-04","text":"(cobra bots) do not use a queue to store messages pending processing, let the bot handle queuing","title":"[9.5.4] - 2020-05-04"},{"location":"CHANGELOG/#953-2020-04-29","text":"(http client) better current request cancellation support when the HttpClient destructor is invoked (see #189)","title":"[9.5.3] - 2020-04-29"},{"location":"CHANGELOG/#952-2020-04-27","text":"(cmake) fix cmake broken tls option parsing","title":"[9.5.2] - 2020-04-27"},{"location":"CHANGELOG/#951-2020-04-27","text":"(http client) Set default values for most HttpRequestArgs struct members (fix #185)","title":"[9.5.1] - 2020-04-27"},{"location":"CHANGELOG/#950-2020-04-25","text":"(ssl) Default to OpenSSL on Windows, since it can load the system certificates by default","title":"[9.5.0] - 2020-04-25"},{"location":"CHANGELOG/#941-2020-04-25","text":"(header) Add a space between header name and header value since most http parsers expects it, although it it not required. Cf #184 and #155","title":"[9.4.1] - 2020-04-25"},{"location":"CHANGELOG/#940-2020-04-24","text":"(ssl) Add support for supplying SSL CA from memory, for OpenSSL and MbedTLS backends","title":"[9.4.0] - 2020-04-24"},{"location":"CHANGELOG/#933-2020-04-17","text":"(ixbots) display sent/receive message, per seconds as accumulated","title":"[9.3.3] - 2020-04-17"},{"location":"CHANGELOG/#932-2020-04-17","text":"(ws) add a --logfile option to configure all logs to go to a file","title":"[9.3.2] - 2020-04-17"},{"location":"CHANGELOG/#931-2020-04-16","text":"(cobra bots) add a utility class to factor out the common bots features (heartbeat) and move all bots to used it + convert cobra_subscribe to be a bot and add a unittest for it","title":"[9.3.1] - 2020-04-16"},{"location":"CHANGELOG/#930-2020-04-15","text":"(websocket) add a positive number to the heartbeat message sent, incremented each time the heartbeat is sent","title":"[9.3.0] - 2020-04-15"},{"location":"CHANGELOG/#929-2020-04-15","text":"(ixcobra) change cobra event callback to use a struct instead of several objects, which is more flexible/extensible","title":"[9.2.9] - 2020-04-15"},{"location":"CHANGELOG/#928-2020-04-15","text":"(ixcobra) make CobraConnection_EventType an enum class (CobraEventType)","title":"[9.2.8] - 2020-04-15"},{"location":"CHANGELOG/#927-2020-04-14","text":"(ixsentry) add a library method to upload a payload directly to sentry","title":"[9.2.7] - 2020-04-14"},{"location":"CHANGELOG/#926-2020-04-14","text":"(ixcobra) snake server / handle invalid incoming json messages + cobra subscriber in fluentd mode insert a created_at timestamp entry","title":"[9.2.6] - 2020-04-14"},{"location":"CHANGELOG/#925-2020-04-13","text":"(websocket) WebSocketMessagePtr is a unique_ptr instead of a shared_ptr","title":"[9.2.5] - 2020-04-13"},{"location":"CHANGELOG/#924-2020-04-13","text":"(websocket) use persistent member variable as temp variables to encode/decode zlib messages in order to reduce transient allocations","title":"[9.2.4] - 2020-04-13"},{"location":"CHANGELOG/#923-2020-04-13","text":"(ws) add a --runtime option to ws cobra_subscribe to optionally limit how much time it will run","title":"[9.2.3] - 2020-04-13"},{"location":"CHANGELOG/#922-2020-04-04","text":"(third_party deps) fix #177, update bundled spdlog to 1.6.0","title":"[9.2.2] - 2020-04-04"},{"location":"CHANGELOG/#921-2020-04-04","text":"(windows) when using OpenSSL, the system store is used to populate the cacert. No need to ship a cacert.pem file with your app.","title":"[9.2.1] - 2020-04-04"},{"location":"CHANGELOG/#920-2020-04-04","text":"(windows) ci: windows build with TLS (mbedtls) + verify that we can be build with OpenSSL","title":"[9.2.0] - 2020-04-04"},{"location":"CHANGELOG/#919-2020-03-30","text":"(cobra to statsd bot) add ability to extract a numerical value and send a timer event to statsd, with the --timer option","title":"[9.1.9] - 2020-03-30"},{"location":"CHANGELOG/#918-2020-03-29","text":"(cobra to statsd bot) bot init was missing + capture socket error","title":"[9.1.8] - 2020-03-29"},{"location":"CHANGELOG/#917-2020-03-29","text":"(cobra to statsd bot) add ability to extract a numerical value and send a gauge event to statsd, with the --gauge option","title":"[9.1.7] - 2020-03-29"},{"location":"CHANGELOG/#916-2020-03-29","text":"(ws cobra subscriber) use a Json::StreamWriter to write to std::cout, and save one std::string allocation for each message printed","title":"[9.1.6] - 2020-03-29"},{"location":"CHANGELOG/#915-2020-03-29","text":"(docker) trim down docker image (300M -> 12M) / binary built without symbol and size optimization, and source code not copied over","title":"[9.1.5] - 2020-03-29"},{"location":"CHANGELOG/#914-2020-03-28","text":"(jsoncpp) update bundled copy to version 1.9.3 (at sha 3beb37ea14aec1bdce1a6d542dc464d00f4a6cec)","title":"[9.1.4] - 2020-03-28"},{"location":"CHANGELOG/#913-2020-03-27","text":"(docker) alpine docker build with release with debug info, and bundle ca-certificates","title":"[9.1.3] - 2020-03-27"},{"location":"CHANGELOG/#912-2020-03-26","text":"(mac ssl) rename DarwinSSL -> SecureTransport (see this too -> https://github.com/curl/curl/issues/3733)","title":"[9.1.2] - 2020-03-26"},{"location":"CHANGELOG/#911-2020-03-26","text":"(websocket) fix data race accessing _socket object without mutex protection when calling wakeUpFromPoll in WebSocketTransport.cpp","title":"[9.1.1] - 2020-03-26"},{"location":"CHANGELOG/#910-2020-03-26","text":"(ixcobra) add explicit event types for handshake, authentication and subscription failure, and handle those by exiting in ws_cobra_subcribe and friends","title":"[9.1.0] - 2020-03-26"},{"location":"CHANGELOG/#903-2020-03-24","text":"(ws connect) display statistics about how much time it takes to stop the connection","title":"[9.0.3] - 2020-03-24"},{"location":"CHANGELOG/#902-2020-03-24","text":"(socket) works with unique_ptr instead of shared_ptr in many places","title":"[9.0.2] - 2020-03-24"},{"location":"CHANGELOG/#901-2020-03-24","text":"(socket) selectInterrupt member is an unique_ptr instead of being a shared_ptr","title":"[9.0.1] - 2020-03-24"},{"location":"CHANGELOG/#900-2020-03-23","text":"(websocket) reset per-message deflate codec everytime we connect to a server/client","title":"[9.0.0] - 2020-03-23"},{"location":"CHANGELOG/#834-2020-03-23","text":"(websocket) fix #167, a long standing issue with sending empty messages with per-message deflate extension (and hopefully other zlib bug)","title":"[8.3.4] - 2020-03-23"},{"location":"CHANGELOG/#833-2020-03-22","text":"(cobra to statsd) port to windows and add a unittest","title":"[8.3.3] - 2020-03-22"},{"location":"CHANGELOG/#832-2020-03-20","text":"(websocket+tls) fix hang in tls handshake which could lead to ANR, discovered through unittesting.","title":"[8.3.2] - 2020-03-20"},{"location":"CHANGELOG/#831-2020-03-20","text":"(cobra) CobraMetricsPublisher can be configure with an ix::CobraConfig + more unittest use SSL in server + client","title":"[8.3.1] - 2020-03-20"},{"location":"CHANGELOG/#830-2020-03-18","text":"(websocket) Simplify ping/pong based heartbeat implementation","title":"[8.3.0] - 2020-03-18"},{"location":"CHANGELOG/#827-2020-03-17","text":"(ws) ws connect gains a new option to set the interval at which to send pings (ws) ws echo_server gains a new option (-p) to disable responding to pings with pongs IXWebSocket$ ws connect --ping_interval 2 wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected [2020-03-17 23:53:02.726] [info] Uri: / [2020-03-17 23:53:02.726] [info] Headers: [2020-03-17 23:53:02.727] [info] Connection: Upgrade [2020-03-17 23:53:02.727] [info] Date: Wed, 18 Mar 2020 06:45:05 GMT [2020-03-17 23:53:02.727] [info] Sec-WebSocket-Accept: 0gtqbxW0aVL/QI/ICpLFnRaiKgA= [2020-03-17 23:53:02.727] [info] sec-websocket-extensions: [2020-03-17 23:53:02.727] [info] Server: Kaazing Gateway [2020-03-17 23:53:02.727] [info] Upgrade: websocket [2020-03-17 23:53:04.894] [info] Received pong [2020-03-17 23:53:06.859] [info] Received pong [2020-03-17 23:53:08.881] [info] Received pong [2020-03-17 23:53:10.848] [info] Received pong [2020-03-17 23:53:12.898] [info] Received pong [2020-03-17 23:53:14.865] [info] Received pong [2020-03-17 23:53:16.890] [info] Received pong [2020-03-17 23:53:18.853] [info] Received pong [2020-03-17 23:53:19.388] [info] ws_connect: connection closed: code 1000 reason Normal closure [2020-03-17 23:53:19.502] [info] Received 208 bytes [2020-03-17 23:53:19.502] [info] Sent 0 bytes","title":"[8.2.7] - 2020-03-17"},{"location":"CHANGELOG/#826-2020-03-16","text":"(cobra to sentry bot + docker) default docker file uses mbedtls + ws cobra_to_sentry pass tls options to sentryClient.","title":"[8.2.6] - 2020-03-16"},{"location":"CHANGELOG/#825-2020-03-13","text":"(cobra client) ws cobra subscribe resubscribe at latest position after being disconnected","title":"[8.2.5] - 2020-03-13"},{"location":"CHANGELOG/#824-2020-03-13","text":"(cobra client) can subscribe with a position","title":"[8.2.4] - 2020-03-13"},{"location":"CHANGELOG/#823-2020-03-13","text":"(cobra client) pass the message position to the subscription data callback","title":"[8.2.3] - 2020-03-13"},{"location":"CHANGELOG/#822-2020-03-12","text":"(openssl tls backend) Fix a hand in OpenSSL when using TLS v1.3 ... by disabling TLS v1.3","title":"[8.2.2] - 2020-03-12"},{"location":"CHANGELOG/#821-2020-03-11","text":"(cobra) IXCobraConfig struct has tlsOptions and per message deflate options","title":"[8.2.1] - 2020-03-11"},{"location":"CHANGELOG/#820-2020-03-11","text":"(cobra) add IXCobraConfig struct to pass cobra config around","title":"[8.2.0] - 2020-03-11"},{"location":"CHANGELOG/#819-2020-03-09","text":"(ws cobra_subscribe) add a --fluentd option to wrap a message in an enveloppe so that fluentd can recognize it","title":"[8.1.9] - 2020-03-09"},{"location":"CHANGELOG/#818-2020-03-02","text":"(websocket server) fix regression with disabling zlib extension on the server side. If a client does not support this extension the server will handle it fine. We still need to figure out how to disable the option.","title":"[8.1.8] - 2020-03-02"},{"location":"CHANGELOG/#817-2020-02-26","text":"(websocket) traffic tracker received bytes is message size while it should be wire size","title":"[8.1.7] - 2020-02-26"},{"location":"CHANGELOG/#816-2020-02-26","text":"(ws_connect) display sent/received bytes statistics on exit","title":"[8.1.6] - 2020-02-26"},{"location":"CHANGELOG/#815-2020-02-23","text":"(server) give thread name to some usual worker threads / unittest is broken !!","title":"[8.1.5] - 2020-02-23"},{"location":"CHANGELOG/#814-2020-02-22","text":"(websocket server) fix regression from 8.1.2, where per-deflate message compression was always disabled","title":"[8.1.4] - 2020-02-22"},{"location":"CHANGELOG/#813-2020-02-21","text":"(client + server) Fix #155 / http header parser should treat the space(s) after the : delimiter as optional. Fixing this bug made us discover that websocket sub-protocols are not properly serialiazed, but start with a ,","title":"[8.1.3] - 2020-02-21"},{"location":"CHANGELOG/#812-2020-02-18","text":"(WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server","title":"[8.1.2] - 2020-02-18"},{"location":"CHANGELOG/#811-2020-02-18","text":"(ws cobra to statsd and sentry sender) exit if no messages are received for one minute, which is a sign that something goes wrong on the server side. That should be changed to be configurable in the future","title":"[8.1.1] - 2020-02-18"},{"location":"CHANGELOG/#810-2020-02-13","text":"(http client + sentry minidump upload) Multipart stream closing boundary is invalid + mark some options as mandatory in the command line tools","title":"[8.1.0] - 2020-02-13"},{"location":"CHANGELOG/#807-2020-02-12","text":"(build) remove the unused subtree which was causing some way of installing to break","title":"[8.0.7] - 2020-02-12"},{"location":"CHANGELOG/#806-2020-01-31","text":"(snake) add an option to disable answering pongs as response to pings, to test cobra client behavior with hanged connections","title":"[8.0.6] - 2020-01-31"},{"location":"CHANGELOG/#805-2020-01-31","text":"(IXCobraConnection) set a ping timeout of 90 seconds. If no pong messages are received as responses to ping for a while, give up and close the connection","title":"[8.0.5] - 2020-01-31"},{"location":"CHANGELOG/#804-2020-01-31","text":"(cobra to sentry) remove noisy logging","title":"[8.0.4] - 2020-01-31"},{"location":"CHANGELOG/#803-2020-01-30","text":"(ixcobra) check if we are authenticated in publishNext before trying to publish a message","title":"[8.0.3] - 2020-01-30"},{"location":"CHANGELOG/#802-2020-01-28","text":"Extract severity level when emitting messages to sentry","title":"[8.0.2] - 2020-01-28"},{"location":"CHANGELOG/#801-2020-01-28","text":"Fix bug #151 - If a socket connection is interrupted, calling stop() on the IXWebSocket object blocks until the next retry","title":"[8.0.1] - 2020-01-28"},{"location":"CHANGELOG/#800-2020-01-26","text":"(SocketServer) add ability to bind on an ipv6 address","title":"[8.0.0] - 2020-01-26"},{"location":"CHANGELOG/#796-2020-01-22","text":"(ws) add a dnslookup sub-command, to get the ip address of a remote host","title":"[7.9.6] - 2020-01-22"},{"location":"CHANGELOG/#795-2020-01-14","text":"(windows) fix #144, get rid of stubbed/un-implemented windows schannel ssl backend","title":"[7.9.5] - 2020-01-14"},{"location":"CHANGELOG/#794-2020-01-12","text":"(openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl","title":"[7.9.4] - 2020-01-12"},{"location":"CHANGELOG/#793-2020-01-10","text":"(apple ssl) model write method after the OpenSSL one for consistency","title":"[7.9.3] - 2020-01-10"},{"location":"CHANGELOG/#792-2020-01-06","text":"(apple ssl) unify read and write ssl utility code","title":"[7.9.2] - 2020-01-06"},{"location":"CHANGELOG/#791-2020-01-06","text":"(websocket client) better error propagation when errors are detected while sending data (ws send) detect failures to send big files, terminate in those cases and report error","title":"[7.9.1] - 2020-01-06"},{"location":"CHANGELOG/#790-2020-01-04","text":"(ws send) add option (-x) to disable per message deflate compression","title":"[7.9.0] - 2020-01-04"},{"location":"CHANGELOG/#789-2020-01-04","text":"(ws send + receive) handle all message types (ping + pong + fragment) / investigate #140","title":"[7.8.9] - 2020-01-04"},{"location":"CHANGELOG/#788-2019-12-28","text":"(mbedtls) fix related to private key file parsing and initialization","title":"[7.8.8] - 2019-12-28"},{"location":"CHANGELOG/#786-2019-12-28","text":"(ws cobra to sentry/statsd) fix for handling null events properly for empty queues + use queue to send data to statsd","title":"[7.8.6] - 2019-12-28"},{"location":"CHANGELOG/#785-2019-12-28","text":"(ws cobra to sentry) handle null events for empty queues","title":"[7.8.5] - 2019-12-28"},{"location":"CHANGELOG/#784-2019-12-27","text":"(ws cobra to sentry) game is picked in a fair manner, so that all games get the same share of sent events","title":"[7.8.4] - 2019-12-27"},{"location":"CHANGELOG/#783-2019-12-27","text":"(ws cobra to sentry) refactor queue related code into a class","title":"[7.8.3] - 2019-12-27"},{"location":"CHANGELOG/#782-2019-12-25","text":"(ws cobra to sentry) bound the queue size used to hold up cobra messages before they are sent to sentry. Default queue size is a 100 messages. Without such limit the program runs out of memory when a subscriber receive a lot of messages that cannot make it to sentry","title":"[7.8.2] - 2019-12-25"},{"location":"CHANGELOG/#781-2019-12-25","text":"(ws client) use correct compilation defines so that spdlog is not used as a header only library (reduce binary size and increase compilation speed)","title":"[7.8.1] - 2019-12-25"},{"location":"CHANGELOG/#780-2019-12-24","text":"(ws client) all commands use spdlog instead of std::cerr or std::cout for logging","title":"[7.8.0] - 2019-12-24"},{"location":"CHANGELOG/#765-2019-12-24","text":"(cobra client) send a websocket ping every 30s to keep the connection opened","title":"[7.6.5] - 2019-12-24"},{"location":"CHANGELOG/#764-2019-12-22","text":"(client) error handling, quote url in error case when failing to parse one (ws) ws_cobra_publish: register callbacks before connecting (doc) mention mbedtls in supported ssl server backend","title":"[7.6.4] - 2019-12-22"},{"location":"CHANGELOG/#763-2019-12-20","text":"(tls) add a simple description of the TLS configuration routine for debugging","title":"[7.6.3] - 2019-12-20"},{"location":"CHANGELOG/#762-2019-12-20","text":"(mbedtls) correct support for using own certificate and private key","title":"[7.6.2] - 2019-12-20"},{"location":"CHANGELOG/#761-2019-12-20","text":"(ws commands) in websocket proxy, disable automatic reconnections + in Dockerfile, use alpine 3.11","title":"[7.6.1] - 2019-12-20"},{"location":"CHANGELOG/#760-2019-12-19","text":"(cobra) Add TLS options to all cobra commands and classes. Add example to the doc.","title":"[7.6.0] - 2019-12-19"},{"location":"CHANGELOG/#758-2019-12-18","text":"(cobra-to-sentry) capture application version from device field","title":"[7.5.8] - 2019-12-18"},{"location":"CHANGELOG/#757-2019-12-18","text":"(tls) Experimental TLS server support with mbedtls (windows) + process cert tlsoption (client + server)","title":"[7.5.7] - 2019-12-18"},{"location":"CHANGELOG/#756-2019-12-18","text":"(tls servers) Make it clear that apple ssl and mbedtls backends do not support SSL in server mode","title":"[7.5.6] - 2019-12-18"},{"location":"CHANGELOG/#755-2019-12-17","text":"(tls options client) TLSOptions struct _validated member should be initialized to false","title":"[7.5.5] - 2019-12-17"},{"location":"CHANGELOG/#754-2019-12-16","text":"(websocket client) improve the error message when connecting to a non websocket server Before: Connection error: Got bad status connecting to example.com:443, status: 200, HTTP Status line: HTTP/1.1 200 OK After: Connection error: Expecting status 101 (Switching Protocol), got 200 status connecting to example.com:443, HTTP Status line: HTTP/1.1 200 OK","title":"[7.5.4] - 2019-12-16"},{"location":"CHANGELOG/#753-2019-12-12","text":"(server) attempt at fixing #131 by using blocking writes in server mode","title":"[7.5.3] - 2019-12-12"},{"location":"CHANGELOG/#752-2019-12-11","text":"(ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages","title":"[7.5.2] - 2019-12-11"},{"location":"CHANGELOG/#751-2019-12-06","text":"(mac) convert SSL errors to utf8","title":"[7.5.1] - 2019-12-06"},{"location":"CHANGELOG/#750-2019-12-05","text":"(ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry. In the example below sentry we are sending data too fast, sentry asks us to slow down which we do. Notice how the sent count stop increasing, while we are waiting for 41 seconds. [2019-12-05 15:50:33.759] [info] messages received 2449 sent 3 [2019-12-05 15:50:34.759] [info] messages received 5533 sent 7 [2019-12-05 15:50:35.759] [info] messages received 8612 sent 11 [2019-12-05 15:50:36.759] [info] messages received 11562 sent 15 [2019-12-05 15:50:37.759] [info] messages received 14410 sent 19 [2019-12-05 15:50:38.759] [info] messages received 17236 sent 23 [2019-12-05 15:50:39.282] [error] Error sending data to sentry: 429 [2019-12-05 15:50:39.282] [error] Body: {\"exception\":[{\"stacktrace\":{\"frames\":[{\"filename\":\"WorldScene.lua\",\"function\":\"WorldScene.lua:1935\",\"lineno\":1958},{\"filename\":\"WorldScene.lua\",\"function\":\"onUpdate_WorldCam\",\"lineno\":1921},{\"filename\":\"WorldMapTile.lua\",\"function\":\"__index\",\"lineno\":239}]},\"value\":\"noisytypes: Attempt to call nil(nil,2224139838)!\"}],\"platform\":\"python\",\"sdk\":{\"name\":\"ws\",\"version\":\"1.0.0\"},\"tags\":[[\"game\",\"niso\"],[\"userid\",\"107638363\"],[\"environment\",\"live\"]],\"timestamp\":\"2019-12-05T23:50:39Z\"} [2019-12-05 15:50:39.282] [error] Response: {\"error_name\":\"rate_limit\",\"error\":\"Creation of this event was denied due to rate limiting\"} [2019-12-05 15:50:39.282] [warning] Error 429 - Too Many Requests. ws will sleep and retry after 41 seconds [2019-12-05 15:50:39.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:40.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:41.760] [info] messages received 18839 sent 25 [2019-12-05 15:50:42.761] [info] messages received 18839 sent 25 [2019-12-05 15:50:43.762] [info] messages received 18839 sent 25 [2019-12-05 15:50:44.763] [info] messages received 18839 sent 25 [2019-12-05 15:50:45.768] [info] messages received 18839 sent 25","title":"[7.5.0] - 2019-12-05"},{"location":"CHANGELOG/#745-2019-12-03","text":"(ws) #125 / fix build problem when jsoncpp is not installed locally","title":"[7.4.5] - 2019-12-03"},{"location":"CHANGELOG/#744-2019-12-03","text":"(ws) #125 / cmake detects an already installed jsoncpp and will try to use this one if present","title":"[7.4.4] - 2019-12-03"},{"location":"CHANGELOG/#743-2019-12-03","text":"(http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases","title":"[7.4.3] - 2019-12-03"},{"location":"CHANGELOG/#742-2019-12-02","text":"(client) internal IXDNSLookup class requires a valid cancellation request function callback to be passed in","title":"[7.4.2] - 2019-12-02"},{"location":"CHANGELOG/#741-2019-12-02","text":"(client) fix an overflow in the exponential back off code","title":"[7.4.1] - 2019-12-02"},{"location":"CHANGELOG/#740-2019-11-25","text":"(http client) Add support for multipart HTTP POST upload (ixsentry) Add support for uploading a minidump to sentry","title":"[7.4.0] - 2019-11-25"},{"location":"CHANGELOG/#735-2019-11-20","text":"On Darwin SSL, add ability to skip peer verification.","title":"[7.3.5] - 2019-11-20"},{"location":"CHANGELOG/#734-2019-11-20","text":"32-bits compile fix, courtesy of @fcojavmc","title":"[7.3.4] - 2019-11-20"},{"location":"CHANGELOG/#731-2019-11-16","text":"ws proxy_server / remote server close not forwarded to the client","title":"[7.3.1] - 2019-11-16"},{"location":"CHANGELOG/#730-2019-11-15","text":"New ws command: ws proxy_server .","title":"[7.3.0] - 2019-11-15"},{"location":"CHANGELOG/#722-2019-11-01","text":"Tag a release + minor reformating.","title":"[7.2.2] - 2019-11-01"},{"location":"CHANGELOG/#721-2019-10-26","text":"Add unittest to IXSentryClient to lua backtrace parsing code","title":"[7.2.1] - 2019-10-26"},{"location":"CHANGELOG/#720-2019-10-24","text":"Add cobra_metrics_to_redis sub-command to create streams for each cobra metric event being received.","title":"[7.2.0] - 2019-10-24"},{"location":"CHANGELOG/#710-2019-10-13","text":"Add client support for websocket subprotocol. Look for the new addSubProtocol method for details.","title":"[7.1.0] - 2019-10-13"},{"location":"CHANGELOG/#700-2019-10-01","text":"TLS support in server code, only implemented for the OpenSSL SSL backend for now.","title":"[7.0.0] - 2019-10-01"},{"location":"CHANGELOG/#634-2019-09-30","text":"all ws subcommands propagate tls options to servers (unimplemented) or ws or http client (implemented) (contributed by Matt DeBoer)","title":"[6.3.4] - 2019-09-30"},{"location":"CHANGELOG/#633-2019-09-30","text":"ws has a --version option","title":"[6.3.3] - 2019-09-30"},{"location":"CHANGELOG/#632-2019-09-29","text":"(http + websocket clients) can specify cacert and some other tls options (not implemented on all backend). This makes it so that server certs can finally be validated on windows.","title":"[6.3.2] - 2019-09-29"},{"location":"CHANGELOG/#631-2019-09-29","text":"Add ability to use OpenSSL on apple platforms.","title":"[6.3.1] - 2019-09-29"},{"location":"CHANGELOG/#630-2019-09-28","text":"ixcobra / fix crash in CobraConnection::publishNext when the queue is empty + handle CobraConnection_PublishMode_Batch in CobraMetricsThreadedPublisher","title":"[6.3.0] - 2019-09-28"},{"location":"CHANGELOG/#629-2019-09-27","text":"mbedtls fixes / the unittest now pass on macOS, and hopefully will on Windows/AppVeyor as well.","title":"[6.2.9] - 2019-09-27"},{"location":"CHANGELOG/#628-2019-09-26","text":"Http server: add options to ws https to redirect all requests to a given url. POST requests will get a 200 and an empty response. ws httpd -L --redirect_url https://www.google.com","title":"[6.2.8] - 2019-09-26"},{"location":"CHANGELOG/#627-2019-09-25","text":"Stop having ws send subcommand send a binary message in text mode, which would cause error in make ws_test shell script test.","title":"[6.2.7] - 2019-09-25"},{"location":"CHANGELOG/#626-2019-09-24","text":"Fix 2 race conditions detected with TSan, one in CobraMetricsPublisher::push and another one in WebSocketTransport::sendData (that one was bad).","title":"[6.2.6] - 2019-09-24"},{"location":"CHANGELOG/#625-2019-09-23","text":"Add simple Redis Server which is only capable of doing publish / subscribe. New ws redis_server sub-command to use it. The server is used in the unittest, so that we can run on CI in environment where redis isn not available like github actions env.","title":"[6.2.5] - 2019-09-23"},{"location":"CHANGELOG/#624-2019-09-22","text":"Add options to configure TLS ; contributed by Matt DeBoer. Only implemented for OpenSSL TLS backend for now.","title":"[6.2.4] - 2019-09-22"},{"location":"CHANGELOG/#623-2019-09-21","text":"Fix crash in the Linux unittest in the HTTP client code, in Socket::readBytes Cobra Metrics Publisher code returns the message id of the message that got published, to be used to validated that it got sent properly when receiving an ack.","title":"[6.2.3] - 2019-09-21"},{"location":"CHANGELOG/#622-2019-09-19","text":"In DNS lookup code, make sure the weak pointer we use lives through the expected scope (if branch)","title":"[6.2.2] - 2019-09-19"},{"location":"CHANGELOG/#621-2019-09-17","text":"On error while doing a client handshake, additionally display port number next to the host name","title":"[6.2.1] - 2019-09-17"},{"location":"CHANGELOG/#620-2019-09-09","text":"websocket and http server: server does not close the bound client socket in many cases improve some websocket error messages add a utility function with unittest to parse status line and stop using scanf which triggers warnings on Windows update ws CLI11 (our command line argument parsing library) to the latest, which fix a compiler bug about optional","title":"[6.2.0] - 2019-09-09"},{"location":"CHANGELOG/#610-2019-09-08","text":"move poll wrapper on top of select (only used on Windows) to the ix namespace","title":"[6.1.0] - 2019-09-08"},{"location":"CHANGELOG/#601-2019-09-05","text":"add cobra metrics publisher + server unittest add cobra client + server unittest ws snake (cobra simple server) add basic support for unsubscription + subscribe send the proper subscription data + redis client subscription can be cancelled IXCobraConnection / pdu handlers can crash if they receive json data which is not an object","title":"[6.0.1] - 2019-09-05"},{"location":"CHANGELOG/#600-2019-09-04","text":"all client autobahn test should pass ! zlib/deflate has a bug with windowsbits == 8, so we silently upgrade it to 9/ (fix autobahn test 13.X which uses 8 for the windows size)","title":"[6.0.0] - 2019-09-04"},{"location":"CHANGELOG/#520-2019-09-04","text":"Fragmentation: for sent messages which are compressed, the continuation fragments should not have the rsv1 bit set (fix all autobahn tests for zlib compression 12.X) Websocket Server / do a case insensitive string search when looking for an Upgrade header whose value is websocket. (some client use WebSocket with some upper-case characters)","title":"[5.2.0] - 2019-09-04"},{"location":"CHANGELOG/#519-2019-09-03","text":"ws autobahn / report progress with spdlog::info to get timing info ws autobahn / use condition variables for stopping test case + add more logging on errors","title":"[5.1.9] - 2019-09-03"},{"location":"CHANGELOG/#518-2019-09-03","text":"Per message deflate/compression: handle fragmented messages (fix autobahn test: 12.1.X and probably others)","title":"[5.1.8] - 2019-09-03"},{"location":"CHANGELOG/#517-2019-09-03","text":"Receiving invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling)","title":"[5.1.7] - 2019-09-03"},{"location":"CHANGELOG/#516-2019-09-03","text":"Sending invalid UTF-8 TEXT message should fail and close the connection (fix remaining autobahn test: 6.X UTF-8 Handling) Fix failing unittest which was sending binary data in text mode with WebSocket::send to call properly call WebSocket::sendBinary instead. Validate that the reason is proper utf-8. (fix autobahn test 7.5.1) Validate close codes. Autobahn 7.9.*","title":"[5.1.6] - 2019-09-03"},{"location":"CHANGELOG/#515-2019-09-03","text":"Framentation: data and continuation blocks received out of order (fix autobahn test: 5.9 through 5.20 Fragmentation)","title":"[5.1.5] - 2019-09-03"},{"location":"CHANGELOG/#514-2019-09-03","text":"Sending invalid UTF-8 TEXT message should fail and close the connection (fix tons of autobahn test: 6.X UTF-8 Handling)","title":"[5.1.4] - 2019-09-03"},{"location":"CHANGELOG/#513-2019-09-03","text":"Message type (TEXT or BINARY) is invalid for received fragmented messages (fix autobahn test: 5.3 through 5.8 Fragmentation)","title":"[5.1.3] - 2019-09-03"},{"location":"CHANGELOG/#512-2019-09-02","text":"Ping and Pong messages cannot be fragmented (fix autobahn test: 5.1 and 5.2 Fragmentation)","title":"[5.1.2] - 2019-09-02"},{"location":"CHANGELOG/#511-2019-09-01","text":"Close connections when reserved bits are used (fix autobahn test: 3.X Reserved Bits)","title":"[5.1.1] - 2019-09-01"},{"location":"CHANGELOG/#510-2019-08-31","text":"ws autobahn / Add code to test websocket client compliance with the autobahn test-suite add utf-8 validation code, not hooked up properly yet Ping received with a payload too large (> 125 bytes) trigger a connection closure cobra / add tracking about published messages cobra / publish returns a message id, that can be used when cobra / new message type in the message received handler when publish/ok is received (can be used to implement an ack system).","title":"[5.1.0] - 2019-08-31"},{"location":"CHANGELOG/#509-2019-08-30","text":"User-Agent header is set when not specified. New option to cap the max wait between reconnection attempts. Still default to 10s. (setMaxWaitBetweenReconnectionRetries). ws connect --max_wait 5000 ws://example.com # will only wait 5 seconds max between reconnection attempts","title":"[5.0.9] - 2019-08-30"},{"location":"CHANGELOG/#507-2019-08-23","text":"WebSocket: add new option to pass in extra HTTP headers when connecting. ws connect add new option (-H, works like curl ) to pass in extra HTTP headers when connecting If you run against ws echo_server you will see the headers being received printed in the terminal. ws connect -H \"foo: bar\" -H \"baz: buz\" ws://127.0.0.1:8008 CobraConnection: sets a unique id field for all messages sent to cobra . CobraConnection: sets a counter as a field for each event published.","title":"[5.0.7] - 2019-08-23"},{"location":"CHANGELOG/#506-2019-08-22","text":"Windows: silly compile error (poll should be in the global namespace)","title":"[5.0.6] - 2019-08-22"},{"location":"CHANGELOG/#505-2019-08-22","text":"Windows: use select instead of WSAPoll, through a poll wrapper","title":"[5.0.5] - 2019-08-22"},{"location":"CHANGELOG/#504-2019-08-20","text":"Windows build fixes (there was a problem with the use of ::poll that has a different name on Windows (WSAPoll))","title":"[5.0.4] - 2019-08-20"},{"location":"CHANGELOG/#503-2019-08-14","text":"CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default","title":"[5.0.3] - 2019-08-14"},{"location":"CHANGELOG/#502-2019-08-01","text":"ws cobra_subscribe has a new -q (quiet) option ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) ws cobra_subscribe, cobra_to_statsd and cobra_to_sentry commands have a new option, --filter to restrict the events they want to receive","title":"[5.0.2] - 2019-08-01"},{"location":"CHANGELOG/#501-2019-07-25","text":"ws connect command has a new option to send in binary mode (still default to text) ws connect command has readline history thanks to libnoise-cpp. Now ws connect one can use using arrows to lookup previous sent messages and edit them","title":"[5.0.1] - 2019-07-25"},{"location":"CHANGELOG/#500-2019-06-23","text":"","title":"[5.0.0] - 2019-06-23"},{"location":"CHANGELOG/#changed","text":"New HTTP server / still very early. ws gained a new command, httpd can run a simple webserver serving local files. IXDNSLookup. Uses weak pointer + smart_ptr + shared_from_this instead of static sets + mutex to handle object going away before dns lookup has resolved cobra_to_sentry / backtraces are reversed and line number is not extracted correctly mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found travis CI uses g++ on Linux","title":"Changed"},{"location":"CHANGELOG/#400-2019-06-09","text":"","title":"[4.0.0] - 2019-06-09"},{"location":"CHANGELOG/#changed_1","text":"WebSocket::send() sends message in TEXT mode by default WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text WebSocket::send takes a third arg, binary which default to true (can be text too) WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg Add explicit WebSocket::sendBinary method New headers + WebSocketMessage class to hold message data, still not used across the board Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility. ws echo_server has a -g option to print a greeting message on connect IXSocketMbedTLS: better error handling in close and connect","title":"Changed"},{"location":"CHANGELOG/#312-2019-06-06","text":"","title":"[3.1.2] - 2019-06-06"},{"location":"CHANGELOG/#added","text":"ws connect has a -x option to disable per message deflate Add WebSocket::disablePerMessageDeflate() option.","title":"Added"},{"location":"CHANGELOG/#300-2019-06-xx","text":"","title":"[3.0.0] - 2019-06-xx"},{"location":"CHANGELOG/#changed_2","text":"TLS, aka SSL works on Windows (websocket and http clients) ws command line tool build on Windows Async API for HttpClient HttpClient API changed to use shared_ptr for response and request","title":"Changed"},{"location":"build/","text":"Build CMake CMakefiles for the library and the examples are available. This library has few dependencies, so it is possible to just add the source files into your project. Otherwise the usual way will suffice. mkdir build # make a build dir so that you can build out of tree. cd build cmake -DUSE_TLS=1 .. make -j make install # will install to /usr/local on Unix, on macOS it is a good idea to sudo chown -R `whoami`:staff /usr/local Headers and a static library will be installed to the target dir. There is a unittest which can be executed by typing make test . Options for building: -DBUILD_SHARED_LIBS=ON will build the unittest as a shared libary instead of a static library, which is the default -DUSE_ZLIB=1 will enable zlib support, required for http client + server + websocket per message deflate extension -DUSE_TLS=1 will enable TLS support -DUSE_OPEN_SSL=1 will use openssl for the TLS support (default on Linux and Windows). When using a custom version of openssl (say a prebuilt version, odd runtime problems can happens, as in #319, and special cmake trickery will be required (see this comment ) -DUSE_MBED_TLS=1 will use mbedlts for the TLS support -DUSE_WS=1 will build the ws interactive command line tool -DUSE_TEST=1 will build the unittest If you are on Windows, look at the appveyor file (not maintained much though) or rather the github actions which have instructions for building dependencies. It is also possible to externally include the project, so that everything is fetched over the wire when you build like so: ExternalProject_Add( IXWebSocket GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git ... ) vcpkg It is possible to get IXWebSocket through Microsoft vcpkg . vcpkg install ixwebsocket To use the installed package within a cmake project, use the following: set(CMAKE_TOOLCHAIN_FILE \"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" CACHE STRING \"\") # this is super important in order for cmake to include the vcpkg search/lib paths! # find library and its headers find_path(IXWEBSOCKET_INCLUDE_DIR ixwebsocket/IXWebSocket.h) find_library(IXWEBSOCKET_LIBRARY ixwebsocket) # include headers include_directories(${IXWEBSOCKET_INCLUDE_DIR}) # ... target_link_libraries(${PROJECT_NAME} ... ${IXWEBSOCKET_LIBRARY}) # Cmake will automatically fail the generation if the lib was not found, i.e is set to NOTFOUND Conan Conan is currently supported through a recipe in Conan Center ( Bintray entry ). Package reference Conan 1.21.0 and up: ixwebsocket/7.9.2 Earlier versions: ixwebsocket/7.9.2@_/_ Note that the version listed here might not be the latest one. See Bintray or the recipe itself for the latest version. If you're migrating from the previous, custom Bintray remote, note that the package reference has to be lower-case. Docker There is a Dockerfile for running the unittest on Linux, and to run the ws tool. It is also available on the docker registry. docker run docker.pkg.github.com/machinezone/ixwebsocket/ws:latest --help To use docker-compose you must make a docker container first. $ make docker ... $ docker compose up & ... $ docker exec -it ixwebsocket_ws_1 bash app@ca2340eb9106:~$ ws --help ws is a websocket tool ...","title":"Build"},{"location":"build/#build","text":"","title":"Build"},{"location":"build/#cmake","text":"CMakefiles for the library and the examples are available. This library has few dependencies, so it is possible to just add the source files into your project. Otherwise the usual way will suffice. mkdir build # make a build dir so that you can build out of tree. cd build cmake -DUSE_TLS=1 .. make -j make install # will install to /usr/local on Unix, on macOS it is a good idea to sudo chown -R `whoami`:staff /usr/local Headers and a static library will be installed to the target dir. There is a unittest which can be executed by typing make test . Options for building: -DBUILD_SHARED_LIBS=ON will build the unittest as a shared libary instead of a static library, which is the default -DUSE_ZLIB=1 will enable zlib support, required for http client + server + websocket per message deflate extension -DUSE_TLS=1 will enable TLS support -DUSE_OPEN_SSL=1 will use openssl for the TLS support (default on Linux and Windows). When using a custom version of openssl (say a prebuilt version, odd runtime problems can happens, as in #319, and special cmake trickery will be required (see this comment ) -DUSE_MBED_TLS=1 will use mbedlts for the TLS support -DUSE_WS=1 will build the ws interactive command line tool -DUSE_TEST=1 will build the unittest If you are on Windows, look at the appveyor file (not maintained much though) or rather the github actions which have instructions for building dependencies. It is also possible to externally include the project, so that everything is fetched over the wire when you build like so: ExternalProject_Add( IXWebSocket GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git ... )","title":"CMake"},{"location":"build/#vcpkg","text":"It is possible to get IXWebSocket through Microsoft vcpkg . vcpkg install ixwebsocket To use the installed package within a cmake project, use the following: set(CMAKE_TOOLCHAIN_FILE \"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake\" CACHE STRING \"\") # this is super important in order for cmake to include the vcpkg search/lib paths! # find library and its headers find_path(IXWEBSOCKET_INCLUDE_DIR ixwebsocket/IXWebSocket.h) find_library(IXWEBSOCKET_LIBRARY ixwebsocket) # include headers include_directories(${IXWEBSOCKET_INCLUDE_DIR}) # ... target_link_libraries(${PROJECT_NAME} ... ${IXWEBSOCKET_LIBRARY}) # Cmake will automatically fail the generation if the lib was not found, i.e is set to NOTFOUND","title":"vcpkg"},{"location":"build/#conan","text":"Conan is currently supported through a recipe in Conan Center ( Bintray entry ). Package reference Conan 1.21.0 and up: ixwebsocket/7.9.2 Earlier versions: ixwebsocket/7.9.2@_/_ Note that the version listed here might not be the latest one. See Bintray or the recipe itself for the latest version. If you're migrating from the previous, custom Bintray remote, note that the package reference has to be lower-case.","title":"Conan"},{"location":"build/#docker","text":"There is a Dockerfile for running the unittest on Linux, and to run the ws tool. It is also available on the docker registry. docker run docker.pkg.github.com/machinezone/ixwebsocket/ws:latest --help To use docker-compose you must make a docker container first. $ make docker ... $ docker compose up & ... $ docker exec -it ixwebsocket_ws_1 bash app@ca2340eb9106:~$ ws --help ws is a websocket tool ...","title":"Docker"},{"location":"design/","text":"Implementation details Per Message Deflate compression. The per message deflate compression option is supported. It can lead to very nice bandbwith savings (20x !) if your messages are similar, which is often the case for example for chat applications. All features of the spec should be supported. TLS/SSL Connections can be optionally secured and encrypted with TLS/SSL when using a wss:// endpoint, or using normal un-encrypted socket with ws:// endpoints. AppleSSL is used on iOS and macOS, OpenSSL and mbedTLS can be used on Android, Linux and Windows. If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Polling and background thread work No manual polling to fetch data is required. Data is sent and received instantly by using a background thread for receiving data and the select system call to be notified by the OS of incoming data. No timeout is used for select so that the background thread is only woken up when data is available, to optimize battery life. This is also the recommended way of using select according to the select tutorial, section select law . Read and Writes to the socket are non blocking. Data is sent right away and not enqueued by writing directly to the socket, which is possible since system socket implementations allow concurrent read/writes. Automatic reconnection If the remote end (server) breaks the connection, the code will try to perpetually reconnect, by using an exponential backoff strategy, capped at one retry every 10 seconds. This behavior can be disabled. Large messages Large frames are broken up into smaller chunks or messages to avoid filling up the os tcp buffers, which is permitted thanks to WebSocket fragmentation . Messages up to 1G were sent and received succesfully. Testing The library has an interactive tool which is handy for testing compatibility ith other libraries. We have tested our client against Python, Erlang, Node.js, and C++ websocket server libraries. The unittest tries to be comprehensive, and has been running on multiple platforms, with different sanitizers such as a thread sanitizer to catch data races or the undefined behavior sanitizer. The regression test is running after each commit on github actions for multiple configurations. Limitations On some configuration (mostly Android) certificate validation needs to be setup so that SocketTLSOptions.caFile point to a pem file, such as the one distributed by Firefox. Unless that setup is done connecting to a wss endpoint will display an error. With mbedtls the message will contain error in handshake : X509 - Certificate verification failed, e.g. CRL, CA or signature check failed . Automatic reconnection works at the TCP socket level, and will detect remote end disconnects. However, if the device/computer network become unreachable (by turning off wifi), it is quite hard to reliably and timely detect it at the socket level using recv and send error codes. Here is a good discussion on the subject. This behavior is consistent with other runtimes such as node.js. One way to detect a disconnected device with low level C code is to do a name resolution with DNS but this can be expensive. Mobile devices have good and reliable API to do that. The server code is using select to detect incoming data, and creates one OS thread per connection. This is not as scalable as strategies using epoll or kqueue. C++ code organization Here is a simplistic diagram which explains how the code is structured in term of class/modules. +-----------------------+ --- Public | | Start the receiving Background thread. Auto reconnection. Simple websocket Ping. | IXWebSocket | Interface used by C++ test clients. No IX dependencies. | | +-----------------------+ | | | IXWebSocketServer | Run a server and give each connections its own WebSocket object. | | Each connection is handled in a new OS thread. | | +-----------------------+ --- Private | | | IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient. | | +-----------------------+ | | | IXWebSocketHandshake | Establish the connection between client and server. | | +-----------------------+ | | | IXWebSocket | ws:// Unencrypted Socket handler | IXWebSocketAppleSSL | wss:// TLS encrypted Socket AppleSSL handler. Used on iOS and macOS | IXWebSocketOpenSSL | wss:// TLS encrypted Socket OpenSSL handler. Used on Android and Linux | | Can be used on macOS too. +-----------------------+ | | | IXSocketConnect | Connect to the remote host (client). | | +-----------------------+ | | | IXDNSLookup | Does DNS resolution asynchronously so that it can be interrupted. | | +-----------------------+","title":"Design"},{"location":"design/#implementation-details","text":"","title":"Implementation details"},{"location":"design/#per-message-deflate-compression","text":"The per message deflate compression option is supported. It can lead to very nice bandbwith savings (20x !) if your messages are similar, which is often the case for example for chat applications. All features of the spec should be supported.","title":"Per Message Deflate compression."},{"location":"design/#tlsssl","text":"Connections can be optionally secured and encrypted with TLS/SSL when using a wss:// endpoint, or using normal un-encrypted socket with ws:// endpoints. AppleSSL is used on iOS and macOS, OpenSSL and mbedTLS can be used on Android, Linux and Windows. If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x.","title":"TLS/SSL"},{"location":"design/#polling-and-background-thread-work","text":"No manual polling to fetch data is required. Data is sent and received instantly by using a background thread for receiving data and the select system call to be notified by the OS of incoming data. No timeout is used for select so that the background thread is only woken up when data is available, to optimize battery life. This is also the recommended way of using select according to the select tutorial, section select law . Read and Writes to the socket are non blocking. Data is sent right away and not enqueued by writing directly to the socket, which is possible since system socket implementations allow concurrent read/writes.","title":"Polling and background thread work"},{"location":"design/#automatic-reconnection","text":"If the remote end (server) breaks the connection, the code will try to perpetually reconnect, by using an exponential backoff strategy, capped at one retry every 10 seconds. This behavior can be disabled.","title":"Automatic reconnection"},{"location":"design/#large-messages","text":"Large frames are broken up into smaller chunks or messages to avoid filling up the os tcp buffers, which is permitted thanks to WebSocket fragmentation . Messages up to 1G were sent and received succesfully.","title":"Large messages"},{"location":"design/#testing","text":"The library has an interactive tool which is handy for testing compatibility ith other libraries. We have tested our client against Python, Erlang, Node.js, and C++ websocket server libraries. The unittest tries to be comprehensive, and has been running on multiple platforms, with different sanitizers such as a thread sanitizer to catch data races or the undefined behavior sanitizer. The regression test is running after each commit on github actions for multiple configurations.","title":"Testing"},{"location":"design/#limitations","text":"On some configuration (mostly Android) certificate validation needs to be setup so that SocketTLSOptions.caFile point to a pem file, such as the one distributed by Firefox. Unless that setup is done connecting to a wss endpoint will display an error. With mbedtls the message will contain error in handshake : X509 - Certificate verification failed, e.g. CRL, CA or signature check failed . Automatic reconnection works at the TCP socket level, and will detect remote end disconnects. However, if the device/computer network become unreachable (by turning off wifi), it is quite hard to reliably and timely detect it at the socket level using recv and send error codes. Here is a good discussion on the subject. This behavior is consistent with other runtimes such as node.js. One way to detect a disconnected device with low level C code is to do a name resolution with DNS but this can be expensive. Mobile devices have good and reliable API to do that. The server code is using select to detect incoming data, and creates one OS thread per connection. This is not as scalable as strategies using epoll or kqueue.","title":"Limitations"},{"location":"design/#c-code-organization","text":"Here is a simplistic diagram which explains how the code is structured in term of class/modules. +-----------------------+ --- Public | | Start the receiving Background thread. Auto reconnection. Simple websocket Ping. | IXWebSocket | Interface used by C++ test clients. No IX dependencies. | | +-----------------------+ | | | IXWebSocketServer | Run a server and give each connections its own WebSocket object. | | Each connection is handled in a new OS thread. | | +-----------------------+ --- Private | | | IXWebSocketTransport | Low level websocket code, framing, managing raw socket. Adapted from easywsclient. | | +-----------------------+ | | | IXWebSocketHandshake | Establish the connection between client and server. | | +-----------------------+ | | | IXWebSocket | ws:// Unencrypted Socket handler | IXWebSocketAppleSSL | wss:// TLS encrypted Socket AppleSSL handler. Used on iOS and macOS | IXWebSocketOpenSSL | wss:// TLS encrypted Socket OpenSSL handler. Used on Android and Linux | | Can be used on macOS too. +-----------------------+ | | | IXSocketConnect | Connect to the remote host (client). | | +-----------------------+ | | | IXDNSLookup | Does DNS resolution asynchronously so that it can be interrupted. | | +-----------------------+","title":"C++ code organization"},{"location":"packages/","text":"Notes on how we can update the different packages for ixwebsocket. VCPKG Visit the releases page on Github. A tag must have been made first. Download the latest entry. $ cd /tmp /tmp$ curl -s -O -L https://github.com/machinezone/IXWebSocket/archive/v9.1.9.tar.gz /tmp$ /tmp$ openssl sha512 v9.1.9.tar.gz SHA512(v9.1.9.tar.gz)= f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e Now go punch those values in the vcpkg ixwebsocket port config files. Here is what the diff look like. vcpkg$ git diff diff --git a/ports/ixwebsocket/CONTROL b/ports/ixwebsocket/CONTROL index db9c2adc9..4acae5c3f 100644 --- a/ports/ixwebsocket/CONTROL +++ b/ports/ixwebsocket/CONTROL @@ -1,5 +1,5 @@ Source: ixwebsocket -Version: 8.0.5 +Version: 9.1.9 Build-Depends: zlib Homepage: https://github.com/machinezone/IXWebSocket Description: Lightweight WebSocket Client and Server + HTTP Client and Server diff --git a/ports/ixwebsocket/portfile.cmake b/ports/ixwebsocket/portfile.cmake index de082aece..68e523a05 100644 --- a/ports/ixwebsocket/portfile.cmake +++ b/ports/ixwebsocket/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO machinezone/IXWebSocket - REF v8.0.5 - SHA512 9dcc20d9a0629b92c62a68a8bd7c8206f18dbd9e93289b0b687ec13c478ce9ad1f3563b38c399c8277b0d3812cc78ca725786ba1dedbc3445b9bdb9b689e8add + REF v9.1.9 + SHA512 f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e ) You will need a fork of the vcpkg repo to make a pull request. git fetch upstream git co master git reset --hard upstream/master git push origin master --force Make the pull request (I use a new branch to do that). vcpkg$ git co -b feature/ixwebsocket_9.1.9 M ports/ixwebsocket/CONTROL M ports/ixwebsocket/portfile.cmake Switched to a new branch 'feature/ixwebsocket_9.1.9' vcpkg$ vcpkg$ vcpkg$ git commit -am 'ixwebsocket: update to 9.1.9' [feature/ixwebsocket_9.1.9 8587a4881] ixwebsocket: update to 9.1.9 2 files changed, 3 insertions(+), 3 deletions(-) vcpkg$ vcpkg$ git push fatal: The current branch feature/ixwebsocket_9.1.9 has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin feature/ixwebsocket_9.1.9 vcpkg$ git push --set-upstream origin feature/ixwebsocket_9.1.9 Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 621 bytes | 621.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 4 local objects. remote: remote: Create a pull request for 'feature/ixwebsocket_9.1.9' on GitHub by visiting: remote: https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9 remote: To https://github.com/bsergean/vcpkg.git * [new branch] feature/ixwebsocket_9.1.9 -> feature/ixwebsocket_9.1.9 Branch 'feature/ixwebsocket_9.1.9' set up to track remote branch 'feature/ixwebsocket_9.1.9' from 'origin' by rebasing. vcpkg$ Just visit this url, https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9, printed on the console, to make the pull request.","title":"Packages"},{"location":"packages/#vcpkg","text":"Visit the releases page on Github. A tag must have been made first. Download the latest entry. $ cd /tmp /tmp$ curl -s -O -L https://github.com/machinezone/IXWebSocket/archive/v9.1.9.tar.gz /tmp$ /tmp$ openssl sha512 v9.1.9.tar.gz SHA512(v9.1.9.tar.gz)= f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e Now go punch those values in the vcpkg ixwebsocket port config files. Here is what the diff look like. vcpkg$ git diff diff --git a/ports/ixwebsocket/CONTROL b/ports/ixwebsocket/CONTROL index db9c2adc9..4acae5c3f 100644 --- a/ports/ixwebsocket/CONTROL +++ b/ports/ixwebsocket/CONTROL @@ -1,5 +1,5 @@ Source: ixwebsocket -Version: 8.0.5 +Version: 9.1.9 Build-Depends: zlib Homepage: https://github.com/machinezone/IXWebSocket Description: Lightweight WebSocket Client and Server + HTTP Client and Server diff --git a/ports/ixwebsocket/portfile.cmake b/ports/ixwebsocket/portfile.cmake index de082aece..68e523a05 100644 --- a/ports/ixwebsocket/portfile.cmake +++ b/ports/ixwebsocket/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO machinezone/IXWebSocket - REF v8.0.5 - SHA512 9dcc20d9a0629b92c62a68a8bd7c8206f18dbd9e93289b0b687ec13c478ce9ad1f3563b38c399c8277b0d3812cc78ca725786ba1dedbc3445b9bdb9b689e8add + REF v9.1.9 + SHA512 f1fd731b5f6a9ce6d6d10bee22a5d9d9baaa8ea0564d6c4cd7eb91dcb88a45c49b2c7fdb75f8640a3589c1b30cee33ef5df8dcbb55920d013394d1e33ddd3c8e ) You will need a fork of the vcpkg repo to make a pull request. git fetch upstream git co master git reset --hard upstream/master git push origin master --force Make the pull request (I use a new branch to do that). vcpkg$ git co -b feature/ixwebsocket_9.1.9 M ports/ixwebsocket/CONTROL M ports/ixwebsocket/portfile.cmake Switched to a new branch 'feature/ixwebsocket_9.1.9' vcpkg$ vcpkg$ vcpkg$ git commit -am 'ixwebsocket: update to 9.1.9' [feature/ixwebsocket_9.1.9 8587a4881] ixwebsocket: update to 9.1.9 2 files changed, 3 insertions(+), 3 deletions(-) vcpkg$ vcpkg$ git push fatal: The current branch feature/ixwebsocket_9.1.9 has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin feature/ixwebsocket_9.1.9 vcpkg$ git push --set-upstream origin feature/ixwebsocket_9.1.9 Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 621 bytes | 621.00 KiB/s, done. Total 6 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 4 local objects. remote: remote: Create a pull request for 'feature/ixwebsocket_9.1.9' on GitHub by visiting: remote: https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9 remote: To https://github.com/bsergean/vcpkg.git * [new branch] feature/ixwebsocket_9.1.9 -> feature/ixwebsocket_9.1.9 Branch 'feature/ixwebsocket_9.1.9' set up to track remote branch 'feature/ixwebsocket_9.1.9' from 'origin' by rebasing. vcpkg$ Just visit this url, https://github.com/bsergean/vcpkg/pull/new/feature/ixwebsocket_9.1.9, printed on the console, to make the pull request.","title":"VCPKG"},{"location":"performance/","text":"WebSocket Client performance We will run a client and a server on the same machine, connecting to localhost. This bench is run on a MacBook Pro from 2015. We can receive over 200,000 (small) messages per second, another way to put it is that it takes 5 micro-second to receive and process one message. This is an indication about the minimal latency to receive messages. Receiving messages By using the push_server ws sub-command, the server will send the same message in a loop to any connected client. ws push_server -q --send_msg 'yo' By using the echo_client ws sub-command, with the -m (mute or no_send), we will display statistics on how many messages we can receive per second. $ ws echo_client -m ws://localhost:8008 [2020-08-02 12:31:17.284] [info] ws_echo_client: connected [2020-08-02 12:31:17.284] [info] Uri: / [2020-08-02 12:31:17.284] [info] Headers: [2020-08-02 12:31:17.284] [info] Connection: Upgrade [2020-08-02 12:31:17.284] [info] Sec-WebSocket-Accept: byy/pMK2d0PtRwExaaiOnXJTQHo= [2020-08-02 12:31:17.284] [info] Server: ixwebsocket/10.1.4 macos ssl/SecureTransport zlib 1.2.11 [2020-08-02 12:31:17.284] [info] Upgrade: websocket [2020-08-02 12:31:17.663] [info] messages received: 0 per second 2595307 total [2020-08-02 12:31:18.668] [info] messages received: 79679 per second 2674986 total [2020-08-02 12:31:19.668] [info] messages received: 207438 per second 2882424 total [2020-08-02 12:31:20.673] [info] messages received: 209207 per second 3091631 total [2020-08-02 12:31:21.676] [info] messages received: 216056 per second 3307687 total [2020-08-02 12:31:22.680] [info] messages received: 214927 per second 3522614 total [2020-08-02 12:31:23.684] [info] messages received: 216960 per second 3739574 total [2020-08-02 12:31:24.688] [info] messages received: 215232 per second 3954806 total [2020-08-02 12:31:25.691] [info] messages received: 212300 per second 4167106 total [2020-08-02 12:31:26.694] [info] messages received: 212501 per second 4379607 total [2020-08-02 12:31:27.699] [info] messages received: 212330 per second 4591937 total [2020-08-02 12:31:28.702] [info] messages received: 216511 per second 4808448 total","title":"Performance"},{"location":"performance/#websocket-client-performance","text":"We will run a client and a server on the same machine, connecting to localhost. This bench is run on a MacBook Pro from 2015. We can receive over 200,000 (small) messages per second, another way to put it is that it takes 5 micro-second to receive and process one message. This is an indication about the minimal latency to receive messages.","title":"WebSocket Client performance"},{"location":"performance/#receiving-messages","text":"By using the push_server ws sub-command, the server will send the same message in a loop to any connected client. ws push_server -q --send_msg 'yo' By using the echo_client ws sub-command, with the -m (mute or no_send), we will display statistics on how many messages we can receive per second. $ ws echo_client -m ws://localhost:8008 [2020-08-02 12:31:17.284] [info] ws_echo_client: connected [2020-08-02 12:31:17.284] [info] Uri: / [2020-08-02 12:31:17.284] [info] Headers: [2020-08-02 12:31:17.284] [info] Connection: Upgrade [2020-08-02 12:31:17.284] [info] Sec-WebSocket-Accept: byy/pMK2d0PtRwExaaiOnXJTQHo= [2020-08-02 12:31:17.284] [info] Server: ixwebsocket/10.1.4 macos ssl/SecureTransport zlib 1.2.11 [2020-08-02 12:31:17.284] [info] Upgrade: websocket [2020-08-02 12:31:17.663] [info] messages received: 0 per second 2595307 total [2020-08-02 12:31:18.668] [info] messages received: 79679 per second 2674986 total [2020-08-02 12:31:19.668] [info] messages received: 207438 per second 2882424 total [2020-08-02 12:31:20.673] [info] messages received: 209207 per second 3091631 total [2020-08-02 12:31:21.676] [info] messages received: 216056 per second 3307687 total [2020-08-02 12:31:22.680] [info] messages received: 214927 per second 3522614 total [2020-08-02 12:31:23.684] [info] messages received: 216960 per second 3739574 total [2020-08-02 12:31:24.688] [info] messages received: 215232 per second 3954806 total [2020-08-02 12:31:25.691] [info] messages received: 212300 per second 4167106 total [2020-08-02 12:31:26.694] [info] messages received: 212501 per second 4379607 total [2020-08-02 12:31:27.699] [info] messages received: 212330 per second 4591937 total [2020-08-02 12:31:28.702] [info] messages received: 216511 per second 4808448 total","title":"Receiving messages"},{"location":"usage/","text":"Examples The ws folder countains many interactive programs for chat, file transfers , curl like http clients, demonstrating client and server usage. Windows note To use the network system on Windows, you need to initialize it once with WSAStartup() and clean it up with WSACleanup() . We have helpers for that which you can use, see below. This init would typically take place in your main function. #include int main() { ix::initNetSystem(); ... ix::uninitNetSystem(); return 0; } WebSocket client API #include ... // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // Optional heart beat, sent every 45 seconds when there is not any traffic // to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); // Per message deflate connection is enabled by default. You can tweak its parameters or disable it webSocket.disablePerMessageDeflate(); // Setup a callback to be fired when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << msg->str << std::endl; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // The message can be sent in BINARY mode (useful if you send MsgPack data for example) webSocket.sendBinary(\"some serialized binary data\"); // ... finally ... // Stop the connection webSocket.stop() Sending messages WebSocketSendInfo result = websocket.send(\"foo\") will send a message. If the connection was closed, sending will fail, and the success field of the result object will be set to false. There could also be a compression error in which case the compressError field will be set to true. The payloadSize field and wireSize fields will tell you respectively how much bytes the message weight, and how many bytes were sent on the wire (potentially compressed + counting the message header (a few bytes). There is an optional progress callback that can be passed in as the second argument. If a message is large it will be fragmented into chunks which will be sent independantly. Everytime the we can write a fragment into the OS network cache, the callback will be invoked. If a user wants to cancel a slow send, false should be returned from within the callback. Here is an example code snippet copied from the ws send sub-command. Each fragment weights 32K, so the total integer is the wireSize divided by 32K. As an example if you are sending 32M of data, uncompressed, total will be 1000. current will be set to 0 for the first fragment, then 1, 2 etc... auto result = _webSocket.sendBinary(serializedMsg, [this, throttle](int current, int total) -> bool { spdlog::info(\"ws_send: Step {} out of {}\", current + 1, total); if (throttle) { std::chrono::duration duration(10); std::this_thread::sleep_for(duration); } return _connected; }); The send() and sendText() methods check that the string contains only valid UTF-8 characters. If you know that the string is a valid UTF-8 string you can skip that step and use the sendUtf8Text method instead. With the IXWebSocketSendData overloads of sendUtf8Text and sendBinary it is possible to not only send std::string but also std::vector , std::vector and char* . std::vector data({1, 2, 3, 4}); auto result = webSocket.sendBinary(data); const char* text = \"Hello World!\"; result = webSocket.sendUtf8Text(IXWebSocketSendData(text, strlen(text))); ReadyState getReadyState() returns the state of the connection. There are 4 possible states. ReadyState::Connecting - The connection is not yet open. ReadyState::Open - The connection is open and ready to communicate. ReadyState::Closing - The connection is in the process of closing. ReadyState::Closed - The connection is closed or could not be opened. Open and Close notifications The onMessage event will be fired when the connection is opened or closed. This is similar to the JavaScript browser API , which has open and close events notification that can be registered with the browser addEventListener . webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"send greetings\" << std::endl; // Headers can be inspected (pairs of string/string) std::cout << \"Handshake Headers:\" << std::endl; for (auto it : msg->headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Close) { std::cout << \"disconnected\" << std::endl; // The server can send an explicit code and reason for closing. // This data can be accessed through the closeInfo object. std::cout << msg->closeInfo.code << std::endl; std::cout << msg->closeInfo.reason << std::endl; } } ); Error notification A message will be fired when there is an error with the connection. The message type will be ix::WebSocketMessageType::Error . Multiple fields will be available on the event to describe the error. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Error) { std::stringstream ss; ss << \"Error: \" << msg->errorInfo.reason << std::endl; ss << \"#retries: \" << msg->errorInfo.retries << std::endl; ss << \"Wait time(ms): \" << msg->errorInfo.wait_time << std::endl; ss << \"HTTP Status: \" << msg->errorInfo.http_status << std::endl; std::cout << ss.str() << std::endl; } } ); start, stop websocket.start() connect to the remote server and starts the message receiving background thread. websocket.stop() disconnect from the remote server and closes the background thread. Configuring the remote url The url can be set and queried after a websocket object has been created. You will have to call stop and start if you want to disconnect and connect to that new url. std::string url(\"wss://example.com\"); websocket.configure(url); Ping/Pong support Ping/pong messages are used to implement keep-alive. 2 message types exists to identify ping and pong messages. Note that when a ping message is received, a pong is instantly send back as requested by the WebSocket spec. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Ping || msg->type == ix::WebSocketMessageType::Pong) { std::cout << \"pong data: \" << msg->str << std::endl; } } ); A ping message can be sent to the server, with an optional data string. websocket.ping(\"ping data, optional (empty string is ok): limited to 125 bytes long\"); Heartbeat. You can configure an optional heart beat / keep-alive, sent every 45 seconds when there is no any traffic to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); Supply extra HTTP headers. You can set extra HTTP headers to be sent during the WebSocket handshake. WebSocketHttpHeaders headers; headers[\"foo\"] = \"bar\"; webSocket.setExtraHeaders(headers); Subprotocols You can specify subprotocols to be set during the WebSocket handshake. For more info you can refer to this doc . webSocket.addSubprotocol(\"appProtocol-v1\"); webSocket.addSubprotocol(\"appProtocol-v2\"); The protocol that the server did accept is available in the open info protocol field. std::cout << \"protocol: \" << msg->openInfo.protocol << std::endl; Automatic reconnection Automatic reconnection kicks in when the connection is disconnected without the user consent. This feature is on by default and can be turned off. webSocket.enableAutomaticReconnection(); // turn on webSocket.disableAutomaticReconnection(); // turn off bool enabled = webSocket.isAutomaticReconnectionEnabled(); // query state The technique to calculate wait time is called exponential backoff . Here are the default waiting times between attempts (from connecting with ws connect ws://foo.com ) > Connection error: Got bad status connecting to foo.com, status: 301, HTTP Status line: HTTP/1.1 301 Moved Permanently #retries: 1 Wait time(ms): 100 #retries: 2 Wait time(ms): 200 #retries: 3 Wait time(ms): 400 #retries: 4 Wait time(ms): 800 #retries: 5 Wait time(ms): 1600 #retries: 6 Wait time(ms): 3200 #retries: 7 Wait time(ms): 6400 #retries: 8 Wait time(ms): 10000 The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried. The minimum waiting time can also be set. webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries(); webSocket.setMinWaitBetweenReconnectionRetries(1000); // 1000ms = 1s uint32_t m = webSocket.getMinWaitBetweenReconnectionRetries(); Handshake timeout You can control how long to wait until timing out while waiting for the websocket handshake to be performed. int handshakeTimeoutSecs = 1; setHandshakeTimeout(handshakeTimeoutSecs); WebSocket server API Legacy api This api was actually changed to take a weak_ptr as the first argument to setOnConnectionCallback ; previously it would take a shared_ptr which was creating cycles and then memory leaks problems. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnConnectionCallback( [&server](std::weak_ptr webSocket, std::shared_ptr connectionState) { std::cout << \"Remote ip: \" << connectionState->remoteIp << std::endl; auto ws = webSocket.lock(); if (ws) { ws->setOnMessageCallback( [webSocket, connectionState, &server](const ix::WebSocketMessagePtr msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. auto ws = webSocket.lock(); if (ws) { ws->send(msg->str, msg->binary); } } } } ); } ); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait(); New api The new API does not require to use 2 nested callbacks, which is a bit annoying. The real fix is that there was a memory leak due to a shared_ptr cycle, due to passing down a shared_ptr down to the callbacks. The webSocket reference is guaranteed to be always valid ; by design the callback will never be invoked with a null webSocket object. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnClientMessageCallback([](std::shared_ptr connectionState, ix::WebSocket & webSocket, const ix::WebSocketMessagePtr & msg) { // The ConnectionState object contains information about the connection, // at this point only the client ip address and the port. std::cout << \"Remote ip: \" << connectionState->getRemoteIp() << std::endl; if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << \"\\t\" << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. std::cout << \"Received: \" << msg->str << std::endl; webSocket.send(msg->str, msg->binary); } }); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait(); Heartbeat You can configure an optional heartbeat / keep-alive for the WebSocket server. The heartbeat interval can be adjusted or disabled when constructing the WebSocketServer . Setting the interval to -1 disables the heartbeat feature; this is the default setting. The parameter you set will be applied to every WebSocket object that the server creates. To enable a 45 second heartbeat on a WebSocketServer : int pingIntervalSeconds = 45; ix::WebSocketServer server(port, host, backlog, maxConnections, handshakeTimeoutSecs, addressFamily, pingIntervalSeconds); HTTP client API #include ... // // Preparation // HttpClient httpClient; HttpRequestArgsPtr args = httpClient.createRequest(); // Custom headers can be set WebSocketHttpHeaders headers; headers[\"Foo\"] = \"bar\"; args->extraHeaders = headers; // Timeout options args->connectTimeout = connectTimeout; args->transferTimeout = transferTimeout; // Redirect options args->followRedirects = followRedirects; args->maxRedirects = maxRedirects; // Misc args->compress = compress; // Enable gzip compression args->verbose = verbose; args->logger = [](const std::string& msg) { std::cout << msg; }; // // Synchronous Request // HttpResponsePtr out; std::string url = \"https://www.google.com\"; // HEAD request out = httpClient.head(url, args); // GET request out = httpClient.get(url, args); // POST request with parameters HttpParameters httpParameters; httpParameters[\"foo\"] = \"bar\"; // HTTP form data can be passed in as well, for multi-part upload of files HttpFormDataParameters httpFormDataParameters; httpParameters[\"baz\"] = \"booz\"; out = httpClient.post(url, httpParameters, httpFormDataParameters, args); // POST request with a body out = httpClient.post(url, std::string(\"foo=bar\"), args); // PUT and PATCH are available too. // // Result // auto statusCode = response->statusCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... auto errorCode = response->errorCode; // 200, 404, etc... auto responseHeaders = response->headers; // All the headers in a special case-insensitive unordered_map of (string, string) auto body = response->body; // All the bytes from the response as an std::string auto errorMsg = response->errorMsg; // Descriptive error message in case of failure auto uploadSize = response->uploadSize; // Byte count of uploaded data auto downloadSize = response->downloadSize; // Byte count of downloaded data // // Asynchronous Request // bool async = true; HttpClient httpClient(async); auto args = httpClient.createRequest(url, HttpClient::kGet); // If you define a chunk callback it will be called repeteadly with the // incoming data. This allows to process data on the go or write it to disk // instead of accumulating the data in memory. args.onChunkCallback = [](const std::string& data) { // process data }; // Push the request to a queue, bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response) { // This callback execute in a background thread. Make sure you uses appropriate protection such as mutex auto statusCode = response->statusCode; // acess results // response->body is empty if onChunkCallback was used } ); // ok will be false if your httpClient is not async // A request in progress can be cancelled by setting the cancel flag. It does nothing if the request already completed. args->cancel = true; See this issue for links about uploading files with HTTP multipart. HTTP server API #include ix::HttpServer server(port, hostname); auto res = server.listen(); if (!res.first) { std::cerr << res.second << std::endl; return 1; } server.start(); server.wait(); If you want to handle how requests are processed, implement the setOnConnectionCallback callback, which takes an HttpRequestPtr as input, and returns an HttpResponsePtr. You can look at HttpServer::setDefaultConnectionCallback for a slightly more advanced callback example. setOnConnectionCallback( [this](HttpRequestPtr request, std::shared_ptr connectionState) -> HttpResponsePtr { // Build a string for the response std::stringstream ss; ss << connectionState->getRemoteIp(); << \" \" << request->method << \" \" << request->uri; std::string content = ss.str(); return std::make_shared(200, \"OK\", HttpErrorCode::Ok, WebSocketHttpHeaders(), content); } TLS support and configuration To leverage TLS features, the library must be compiled with the option USE_TLS=1 . If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Then, secure sockets are automatically used when connecting to a wss://* url. Additional TLS options can be configured by passing a ix::SocketTLSOptions instance to the setTLSOptions on ix::WebSocket (or ix::WebSocketServer or ix::HttpServer ) webSocket.setTLSOptions({ .certFile = \"path/to/cert/file.pem\", .keyFile = \"path/to/key/file.pem\", .caFile = \"path/to/trust/bundle/file.pem\", // as a file, or in memory buffer in PEM format .tls = true // required in server mode }); Specifying certFile and keyFile configures the certificate that will be used to communicate with TLS peers. On a client, this is only necessary for connecting to servers that require a client certificate. On a server, this is necessary for TLS support. Specifying caFile configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates. - The special value of SYSTEM (the default) indicates that the system-configured trust bundle should be used; this is generally what you want when connecting to any publicly exposed API/server. - The special value of NONE can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity. - If the value contain the special value -----BEGIN CERTIFICATE----- , the value will be read from memory, and not from a file. This is convenient on platforms like Android where reading / writing to the file system can be challenging without proper permissions, or without knowing the location of a temp directory. For a client, specifying caFile can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment. For a server, specifying caFile implies that: 1. You require clients to present a certificate 1. It must be signed by one of the trusted roots in the file By default, a destination's hostname is always validated against the certificate that it presents. To accept certificates with any hostname, set ix::SocketTLSOptions::disable_hostname_validation to true .","title":"Examples"},{"location":"usage/#examples","text":"The ws folder countains many interactive programs for chat, file transfers , curl like http clients, demonstrating client and server usage.","title":"Examples"},{"location":"usage/#windows-note","text":"To use the network system on Windows, you need to initialize it once with WSAStartup() and clean it up with WSACleanup() . We have helpers for that which you can use, see below. This init would typically take place in your main function. #include int main() { ix::initNetSystem(); ... ix::uninitNetSystem(); return 0; }","title":"Windows note"},{"location":"usage/#websocket-client-api","text":"#include ... // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // Optional heart beat, sent every 45 seconds when there is not any traffic // to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45); // Per message deflate connection is enabled by default. You can tweak its parameters or disable it webSocket.disablePerMessageDeflate(); // Setup a callback to be fired when a message or an event (open, close, error) is received webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Message) { std::cout << msg->str << std::endl; } } ); // Now that our callback is setup, we can start our background thread and receive messages webSocket.start(); // Send a message to the server (default to TEXT mode) webSocket.send(\"hello world\"); // The message can be sent in BINARY mode (useful if you send MsgPack data for example) webSocket.sendBinary(\"some serialized binary data\"); // ... finally ... // Stop the connection webSocket.stop()","title":"WebSocket client API"},{"location":"usage/#sending-messages","text":"WebSocketSendInfo result = websocket.send(\"foo\") will send a message. If the connection was closed, sending will fail, and the success field of the result object will be set to false. There could also be a compression error in which case the compressError field will be set to true. The payloadSize field and wireSize fields will tell you respectively how much bytes the message weight, and how many bytes were sent on the wire (potentially compressed + counting the message header (a few bytes). There is an optional progress callback that can be passed in as the second argument. If a message is large it will be fragmented into chunks which will be sent independantly. Everytime the we can write a fragment into the OS network cache, the callback will be invoked. If a user wants to cancel a slow send, false should be returned from within the callback. Here is an example code snippet copied from the ws send sub-command. Each fragment weights 32K, so the total integer is the wireSize divided by 32K. As an example if you are sending 32M of data, uncompressed, total will be 1000. current will be set to 0 for the first fragment, then 1, 2 etc... auto result = _webSocket.sendBinary(serializedMsg, [this, throttle](int current, int total) -> bool { spdlog::info(\"ws_send: Step {} out of {}\", current + 1, total); if (throttle) { std::chrono::duration duration(10); std::this_thread::sleep_for(duration); } return _connected; }); The send() and sendText() methods check that the string contains only valid UTF-8 characters. If you know that the string is a valid UTF-8 string you can skip that step and use the sendUtf8Text method instead. With the IXWebSocketSendData overloads of sendUtf8Text and sendBinary it is possible to not only send std::string but also std::vector , std::vector and char* . std::vector data({1, 2, 3, 4}); auto result = webSocket.sendBinary(data); const char* text = \"Hello World!\"; result = webSocket.sendUtf8Text(IXWebSocketSendData(text, strlen(text)));","title":"Sending messages"},{"location":"usage/#readystate","text":"getReadyState() returns the state of the connection. There are 4 possible states. ReadyState::Connecting - The connection is not yet open. ReadyState::Open - The connection is open and ready to communicate. ReadyState::Closing - The connection is in the process of closing. ReadyState::Closed - The connection is closed or could not be opened.","title":"ReadyState"},{"location":"usage/#open-and-close-notifications","text":"The onMessage event will be fired when the connection is opened or closed. This is similar to the JavaScript browser API , which has open and close events notification that can be registered with the browser addEventListener . webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"send greetings\" << std::endl; // Headers can be inspected (pairs of string/string) std::cout << \"Handshake Headers:\" << std::endl; for (auto it : msg->headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Close) { std::cout << \"disconnected\" << std::endl; // The server can send an explicit code and reason for closing. // This data can be accessed through the closeInfo object. std::cout << msg->closeInfo.code << std::endl; std::cout << msg->closeInfo.reason << std::endl; } } );","title":"Open and Close notifications"},{"location":"usage/#error-notification","text":"A message will be fired when there is an error with the connection. The message type will be ix::WebSocketMessageType::Error . Multiple fields will be available on the event to describe the error. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Error) { std::stringstream ss; ss << \"Error: \" << msg->errorInfo.reason << std::endl; ss << \"#retries: \" << msg->errorInfo.retries << std::endl; ss << \"Wait time(ms): \" << msg->errorInfo.wait_time << std::endl; ss << \"HTTP Status: \" << msg->errorInfo.http_status << std::endl; std::cout << ss.str() << std::endl; } } );","title":"Error notification"},{"location":"usage/#start-stop","text":"websocket.start() connect to the remote server and starts the message receiving background thread. websocket.stop() disconnect from the remote server and closes the background thread.","title":"start, stop"},{"location":"usage/#configuring-the-remote-url","text":"The url can be set and queried after a websocket object has been created. You will have to call stop and start if you want to disconnect and connect to that new url. std::string url(\"wss://example.com\"); websocket.configure(url);","title":"Configuring the remote url"},{"location":"usage/#pingpong-support","text":"Ping/pong messages are used to implement keep-alive. 2 message types exists to identify ping and pong messages. Note that when a ping message is received, a pong is instantly send back as requested by the WebSocket spec. webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr& msg) { if (msg->type == ix::WebSocketMessageType::Ping || msg->type == ix::WebSocketMessageType::Pong) { std::cout << \"pong data: \" << msg->str << std::endl; } } ); A ping message can be sent to the server, with an optional data string. websocket.ping(\"ping data, optional (empty string is ok): limited to 125 bytes long\");","title":"Ping/Pong support"},{"location":"usage/#heartbeat","text":"You can configure an optional heart beat / keep-alive, sent every 45 seconds when there is no any traffic to make sure that load balancers do not kill an idle connection. webSocket.setPingInterval(45);","title":"Heartbeat."},{"location":"usage/#supply-extra-http-headers","text":"You can set extra HTTP headers to be sent during the WebSocket handshake. WebSocketHttpHeaders headers; headers[\"foo\"] = \"bar\"; webSocket.setExtraHeaders(headers);","title":"Supply extra HTTP headers."},{"location":"usage/#subprotocols","text":"You can specify subprotocols to be set during the WebSocket handshake. For more info you can refer to this doc . webSocket.addSubprotocol(\"appProtocol-v1\"); webSocket.addSubprotocol(\"appProtocol-v2\"); The protocol that the server did accept is available in the open info protocol field. std::cout << \"protocol: \" << msg->openInfo.protocol << std::endl;","title":"Subprotocols"},{"location":"usage/#automatic-reconnection","text":"Automatic reconnection kicks in when the connection is disconnected without the user consent. This feature is on by default and can be turned off. webSocket.enableAutomaticReconnection(); // turn on webSocket.disableAutomaticReconnection(); // turn off bool enabled = webSocket.isAutomaticReconnectionEnabled(); // query state The technique to calculate wait time is called exponential backoff . Here are the default waiting times between attempts (from connecting with ws connect ws://foo.com ) > Connection error: Got bad status connecting to foo.com, status: 301, HTTP Status line: HTTP/1.1 301 Moved Permanently #retries: 1 Wait time(ms): 100 #retries: 2 Wait time(ms): 200 #retries: 3 Wait time(ms): 400 #retries: 4 Wait time(ms): 800 #retries: 5 Wait time(ms): 1600 #retries: 6 Wait time(ms): 3200 #retries: 7 Wait time(ms): 6400 #retries: 8 Wait time(ms): 10000 The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried. The minimum waiting time can also be set. webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries(); webSocket.setMinWaitBetweenReconnectionRetries(1000); // 1000ms = 1s uint32_t m = webSocket.getMinWaitBetweenReconnectionRetries();","title":"Automatic reconnection"},{"location":"usage/#handshake-timeout","text":"You can control how long to wait until timing out while waiting for the websocket handshake to be performed. int handshakeTimeoutSecs = 1; setHandshakeTimeout(handshakeTimeoutSecs);","title":"Handshake timeout"},{"location":"usage/#websocket-server-api","text":"","title":"WebSocket server API"},{"location":"usage/#legacy-api","text":"This api was actually changed to take a weak_ptr as the first argument to setOnConnectionCallback ; previously it would take a shared_ptr which was creating cycles and then memory leaks problems. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnConnectionCallback( [&server](std::weak_ptr webSocket, std::shared_ptr connectionState) { std::cout << \"Remote ip: \" << connectionState->remoteIp << std::endl; auto ws = webSocket.lock(); if (ws) { ws->setOnMessageCallback( [webSocket, connectionState, &server](const ix::WebSocketMessagePtr msg) { if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. auto ws = webSocket.lock(); if (ws) { ws->send(msg->str, msg->binary); } } } } ); } ); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait();","title":"Legacy api"},{"location":"usage/#new-api","text":"The new API does not require to use 2 nested callbacks, which is a bit annoying. The real fix is that there was a memory leak due to a shared_ptr cycle, due to passing down a shared_ptr down to the callbacks. The webSocket reference is guaranteed to be always valid ; by design the callback will never be invoked with a null webSocket object. #include ... // Run a server on localhost at a given port. // Bound host name, max connections and listen backlog can also be passed in as parameters. int port = 8008; std::string host(\"127.0.0.1\"); // If you need this server to be accessible on a different machine, use \"0.0.0.0\" ix::WebSocketServer server(port, host); server.setOnClientMessageCallback([](std::shared_ptr connectionState, ix::WebSocket & webSocket, const ix::WebSocketMessagePtr & msg) { // The ConnectionState object contains information about the connection, // at this point only the client ip address and the port. std::cout << \"Remote ip: \" << connectionState->getRemoteIp() << std::endl; if (msg->type == ix::WebSocketMessageType::Open) { std::cout << \"New connection\" << std::endl; // A connection state object is available, and has a default id // You can subclass ConnectionState and pass an alternate factory // to override it. It is useful if you want to store custom // attributes per connection (authenticated bool flag, attributes, etc...) std::cout << \"id: \" << connectionState->getId() << std::endl; // The uri the client did connect to. std::cout << \"Uri: \" << msg->openInfo.uri << std::endl; std::cout << \"Headers:\" << std::endl; for (auto it : msg->openInfo.headers) { std::cout << \"\\t\" << it.first << \": \" << it.second << std::endl; } } else if (msg->type == ix::WebSocketMessageType::Message) { // For an echo server, we just send back to the client whatever was received by the server // All connected clients are available in an std::set. See the broadcast cpp example. // Second parameter tells whether we are sending the message in binary or text mode. // Here we send it in the same mode as it was received. std::cout << \"Received: \" << msg->str << std::endl; webSocket.send(msg->str, msg->binary); } }); auto res = server.listen(); if (!res.first) { // Error handling return 1; } // Per message deflate connection is enabled by default. It can be disabled // which might be helpful when running on low power devices such as a Rasbery Pi server.disablePerMessageDeflate(); // Run the server in the background. Server can be stoped by calling server.stop() server.start(); // Block until server.stop() is called. server.wait();","title":"New api"},{"location":"usage/#heartbeat_1","text":"You can configure an optional heartbeat / keep-alive for the WebSocket server. The heartbeat interval can be adjusted or disabled when constructing the WebSocketServer . Setting the interval to -1 disables the heartbeat feature; this is the default setting. The parameter you set will be applied to every WebSocket object that the server creates. To enable a 45 second heartbeat on a WebSocketServer : int pingIntervalSeconds = 45; ix::WebSocketServer server(port, host, backlog, maxConnections, handshakeTimeoutSecs, addressFamily, pingIntervalSeconds);","title":"Heartbeat"},{"location":"usage/#http-client-api","text":"#include ... // // Preparation // HttpClient httpClient; HttpRequestArgsPtr args = httpClient.createRequest(); // Custom headers can be set WebSocketHttpHeaders headers; headers[\"Foo\"] = \"bar\"; args->extraHeaders = headers; // Timeout options args->connectTimeout = connectTimeout; args->transferTimeout = transferTimeout; // Redirect options args->followRedirects = followRedirects; args->maxRedirects = maxRedirects; // Misc args->compress = compress; // Enable gzip compression args->verbose = verbose; args->logger = [](const std::string& msg) { std::cout << msg; }; // // Synchronous Request // HttpResponsePtr out; std::string url = \"https://www.google.com\"; // HEAD request out = httpClient.head(url, args); // GET request out = httpClient.get(url, args); // POST request with parameters HttpParameters httpParameters; httpParameters[\"foo\"] = \"bar\"; // HTTP form data can be passed in as well, for multi-part upload of files HttpFormDataParameters httpFormDataParameters; httpParameters[\"baz\"] = \"booz\"; out = httpClient.post(url, httpParameters, httpFormDataParameters, args); // POST request with a body out = httpClient.post(url, std::string(\"foo=bar\"), args); // PUT and PATCH are available too. // // Result // auto statusCode = response->statusCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... auto errorCode = response->errorCode; // 200, 404, etc... auto responseHeaders = response->headers; // All the headers in a special case-insensitive unordered_map of (string, string) auto body = response->body; // All the bytes from the response as an std::string auto errorMsg = response->errorMsg; // Descriptive error message in case of failure auto uploadSize = response->uploadSize; // Byte count of uploaded data auto downloadSize = response->downloadSize; // Byte count of downloaded data // // Asynchronous Request // bool async = true; HttpClient httpClient(async); auto args = httpClient.createRequest(url, HttpClient::kGet); // If you define a chunk callback it will be called repeteadly with the // incoming data. This allows to process data on the go or write it to disk // instead of accumulating the data in memory. args.onChunkCallback = [](const std::string& data) { // process data }; // Push the request to a queue, bool ok = httpClient.performRequest(args, [](const HttpResponsePtr& response) { // This callback execute in a background thread. Make sure you uses appropriate protection such as mutex auto statusCode = response->statusCode; // acess results // response->body is empty if onChunkCallback was used } ); // ok will be false if your httpClient is not async // A request in progress can be cancelled by setting the cancel flag. It does nothing if the request already completed. args->cancel = true; See this issue for links about uploading files with HTTP multipart.","title":"HTTP client API"},{"location":"usage/#http-server-api","text":"#include ix::HttpServer server(port, hostname); auto res = server.listen(); if (!res.first) { std::cerr << res.second << std::endl; return 1; } server.start(); server.wait(); If you want to handle how requests are processed, implement the setOnConnectionCallback callback, which takes an HttpRequestPtr as input, and returns an HttpResponsePtr. You can look at HttpServer::setDefaultConnectionCallback for a slightly more advanced callback example. setOnConnectionCallback( [this](HttpRequestPtr request, std::shared_ptr connectionState) -> HttpResponsePtr { // Build a string for the response std::stringstream ss; ss << connectionState->getRemoteIp(); << \" \" << request->method << \" \" << request->uri; std::string content = ss.str(); return std::make_shared(200, \"OK\", HttpErrorCode::Ok, WebSocketHttpHeaders(), content); }","title":"HTTP server API"},{"location":"usage/#tls-support-and-configuration","text":"To leverage TLS features, the library must be compiled with the option USE_TLS=1 . If you are using OpenSSL, try to be on a version higher than 1.1.x as there there are thread safety problems with 1.0.x. Then, secure sockets are automatically used when connecting to a wss://* url. Additional TLS options can be configured by passing a ix::SocketTLSOptions instance to the setTLSOptions on ix::WebSocket (or ix::WebSocketServer or ix::HttpServer ) webSocket.setTLSOptions({ .certFile = \"path/to/cert/file.pem\", .keyFile = \"path/to/key/file.pem\", .caFile = \"path/to/trust/bundle/file.pem\", // as a file, or in memory buffer in PEM format .tls = true // required in server mode }); Specifying certFile and keyFile configures the certificate that will be used to communicate with TLS peers. On a client, this is only necessary for connecting to servers that require a client certificate. On a server, this is necessary for TLS support. Specifying caFile configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates. - The special value of SYSTEM (the default) indicates that the system-configured trust bundle should be used; this is generally what you want when connecting to any publicly exposed API/server. - The special value of NONE can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity. - If the value contain the special value -----BEGIN CERTIFICATE----- , the value will be read from memory, and not from a file. This is convenient on platforms like Android where reading / writing to the file system can be challenging without proper permissions, or without knowing the location of a temp directory. For a client, specifying caFile can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment. For a server, specifying caFile implies that: 1. You require clients to present a certificate 1. It must be signed by one of the trusted roots in the file By default, a destination's hostname is always validated against the certificate that it presents. To accept certificates with any hostname, set ix::SocketTLSOptions::disable_hostname_validation to true .","title":"TLS support and configuration"},{"location":"ws/","text":"General ws is a command line tool that should exercise most of the IXWebSocket code, and provide example code. ws is a websocket tool Usage: ws [OPTIONS] SUBCOMMAND Options: -h,--help Print this help message and exit Subcommands: send Send a file receive Receive a file transfer Broadcasting server connect Connect to a remote server chat Group chat echo_server Echo server broadcast_server Broadcasting server ping Ping pong curl HTTP Client httpd HTTP server curl The curl subcommand try to be compatible with the curl syntax, to fetch http pages. Making a HEAD request with the -I parameter. $ ws curl -I https://www.google.com/ Accept-Ranges: none Alt-Svc: quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Date: Tue, 08 Oct 2019 21:36:57 GMT Expires: -1 P3P: CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\" Server: gws Set-Cookie: NID=188=ASwfz8GrXQrHCLqAz-AndLOMLcz0rC9yecnf3h0yXZxRL3rTufTU_GDDwERp7qQL7LZ_EB8gCRyPXGERyOSAgaqgnrkoTmvWrwFemRLMaOZ896GrHobi5fV7VLklnSG2w48Gj8xMlwxfP7Z-bX-xR9UZxep1tHM6UmFQdD_GkBE; expires=Wed, 08-Apr-2020 21:36:57 GMT; path=/; domain=.google.com; HttpOnly Transfer-Encoding: chunked Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-XSS-Protection: 0 Upload size: 143 Download size: 0 Status: 200 Making a POST request with the -F parameter. $ ws curl -F foo=bar https://httpbin.org/post foo: bar Downloaded 438 bytes out of 438 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 438 Content-Type: application/json Date: Tue, 08 Oct 2019 21:47:54 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 219 Download size: 438 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } Passing in a custom header with -H. $ ws curl -F foo=bar -H 'my_custom_header: baz' https://httpbin.org/post my_custom_header: baz foo: bar Downloaded 470 bytes out of 470 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 470 Content-Type: application/json Date: Tue, 08 Oct 2019 21:50:25 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 243 Download size: 470 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"My-Custom-Header\": \"baz\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } connect The connect command connects to a websocket endpoint, and starts an interactive prompt. Line editing, such as using the direction keys to fetch the last thing you tried to type) is provided. That command is pretty useful to try to send random data to an endpoint and verify that the service handles it with grace (such as sending invalid json). ws connect wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected Uri: / Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:38:44 GMT Sec-WebSocket-Accept: 2j6LBScZveqrMx1W/GJkCWvZo3M= sec-websocket-extensions: Server: Kaazing Gateway Upgrade: websocket Received ping Received ping Received ping Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! > Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! ws connect 'ws://jeanserge.com/v2?appkey=_pubsub' Type Ctrl-D to exit prompt... Connecting to url: ws://jeanserge.com/v2?appkey=_pubsub > ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:28 GMT Sec-WebSocket-Accept: LYHmjh9Gsu/Yw7aumQqyPObOEV4= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket bababababababab > ws_connect: connection closed: code 1000 reason ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:44 GMT Sec-WebSocket-Accept: I1rqxdLgTU+opPi5/zKPBTuXdLw= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket It is possible to pass custom HTTP header when doing the connection handshake, the remote server might process them to implement a simple authorization scheme. src$ ws connect -H Authorization:supersecret ws://localhost:8008 Type Ctrl-D to exit prompt... [2020-12-17 22:35:08.732] [info] Authorization: supersecret Connecting to url: ws://localhost:8008 > [2020-12-17 22:35:08.736] [info] ws_connect: connected [2020-12-17 22:35:08.736] [info] Uri: / [2020-12-17 22:35:08.736] [info] Headers: [2020-12-17 22:35:08.736] [info] Connection: Upgrade [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Accept: 2yaTFcdwn8KL6IzSMj2u6Le7KTg= [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.736] [info] Server: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:08.736] [info] Upgrade: websocket [2020-12-17 22:35:08.736] [info] Received 25 bytes ws_connect: received message: Authorization suceeded! [2020-12-17 22:35:08.736] [info] Received pong ixwebsocket::heartbeat::30s::0 hello > [2020-12-17 22:35:25.157] [info] Received 7 bytes ws_connect: received message: hello If the wrong header is passed in, the server would close the connection with a custom close code (>4000, and <4999). [2020-12-17 22:39:37.044] [info] Upgrade: websocket ws_connect: connection closed: code 4001 reason Permission denied echo server The ws echo server will respond what the client just sent him. If we use the simple --http_authorization_header we can enforce that client need to pass a special value in the Authorization header to connect. $ ws echo_server --http_authorization_header supersecret [2020-12-17 22:35:06.192] [info] Listening on 127.0.0.1:8008 [2020-12-17 22:35:08.735] [info] New connection [2020-12-17 22:35:08.735] [info] remote ip: 127.0.0.1 [2020-12-17 22:35:08.735] [info] id: 0 [2020-12-17 22:35:08.735] [info] Uri: / [2020-12-17 22:35:08.735] [info] Headers: [2020-12-17 22:35:08.735] [info] Authorization: supersecret [2020-12-17 22:35:08.735] [info] Connection: Upgrade [2020-12-17 22:35:08.735] [info] Host: localhost:8008 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Key: eFF2Gf25dC7eC15Ab1135G== [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Version: 13 [2020-12-17 22:35:08.735] [info] Upgrade: websocket [2020-12-17 22:35:08.735] [info] User-Agent: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:25.157] [info] Received 7 bytes Websocket proxy ws proxy_server --remote_host ws://127.0.0.1:9000 -v Listening on 127.0.0.1:8008 If you connect to ws://127.0.0.1:8008, the proxy will connect to ws://127.0.0.1:9000 and pass all traffic to this server. You can also use a more complex setup if you want to redirect to different websocket servers based on the hostname your client is trying to connect to. If you have multiple CNAME aliases that point to the same server. A JSON config file is used to express that mapping ; here connecting to echo.jeanserge.com will proxy the client to ws://localhost:8008 on the local machine (which actually runs ws echo_server), while connecting to bavarde.jeanserge.com will proxy the client to ws://localhost:5678 where a cobra python server is running. As a side note you will need a wildcard SSL certificate if you want to have SSL enabled on that machine. echo.jeanserge.com=ws://localhost:8008 bavarde.jeanserge.com=ws://localhost:5678 The --config_path option is required to instruct ws proxy_server to read that file. ws proxy_server --config_path proxyConfig.json --port 8765 File transfer # Start transfer server, which is just a broadcast server at this point ws transfer # running on port 8080. # Start receiver first ws receive ws://localhost:8080 # Then send a file. File will be received and written to disk by the receiver process ws send ws://localhost:8080 /file/to/path HTTP Client $ ws curl --help HTTP Client Usage: ws curl [OPTIONS] url Positionals: url TEXT REQUIRED Connection url Options: -h,--help Print this help message and exit -d TEXT Form data -F TEXT Form data -H TEXT Header --output TEXT Output file -I Send a HEAD request -L Follow redirects --max-redirects INT Max Redirects -v Verbose -O Save output to disk --compress Enable gzip compression --connect-timeout INT Connection timeout --transfer-timeout INT Transfer timeout","title":"Ws"},{"location":"ws/#general","text":"ws is a command line tool that should exercise most of the IXWebSocket code, and provide example code. ws is a websocket tool Usage: ws [OPTIONS] SUBCOMMAND Options: -h,--help Print this help message and exit Subcommands: send Send a file receive Receive a file transfer Broadcasting server connect Connect to a remote server chat Group chat echo_server Echo server broadcast_server Broadcasting server ping Ping pong curl HTTP Client httpd HTTP server","title":"General"},{"location":"ws/#curl","text":"The curl subcommand try to be compatible with the curl syntax, to fetch http pages. Making a HEAD request with the -I parameter. $ ws curl -I https://www.google.com/ Accept-Ranges: none Alt-Svc: quic=\":443\"; ma=2592000; v=\"46,43\",h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Date: Tue, 08 Oct 2019 21:36:57 GMT Expires: -1 P3P: CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\" Server: gws Set-Cookie: NID=188=ASwfz8GrXQrHCLqAz-AndLOMLcz0rC9yecnf3h0yXZxRL3rTufTU_GDDwERp7qQL7LZ_EB8gCRyPXGERyOSAgaqgnrkoTmvWrwFemRLMaOZ896GrHobi5fV7VLklnSG2w48Gj8xMlwxfP7Z-bX-xR9UZxep1tHM6UmFQdD_GkBE; expires=Wed, 08-Apr-2020 21:36:57 GMT; path=/; domain=.google.com; HttpOnly Transfer-Encoding: chunked Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-XSS-Protection: 0 Upload size: 143 Download size: 0 Status: 200 Making a POST request with the -F parameter. $ ws curl -F foo=bar https://httpbin.org/post foo: bar Downloaded 438 bytes out of 438 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 438 Content-Type: application/json Date: Tue, 08 Oct 2019 21:47:54 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 219 Download size: 438 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" } Passing in a custom header with -H. $ ws curl -F foo=bar -H 'my_custom_header: baz' https://httpbin.org/post my_custom_header: baz foo: bar Downloaded 470 bytes out of 470 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Connection: keep-alive Content-Encoding: Content-Length: 470 Content-Type: application/json Date: Tue, 08 Oct 2019 21:50:25 GMT Referrer-Policy: no-referrer-when-downgrade Server: nginx X-Content-Type-Options: nosniff X-Frame-Options: DENY X-XSS-Protection: 1; mode=block Upload size: 243 Download size: 470 Status: 200 payload: { \"args\": {}, \"data\": \"\", \"files\": {}, \"form\": { \"foo\": \"bar\" }, \"headers\": { \"Accept\": \"*/*\", \"Content-Length\": \"7\", \"Content-Type\": \"application/x-www-form-urlencoded\", \"Host\": \"httpbin.org\", \"My-Custom-Header\": \"baz\", \"User-Agent\": \"ixwebsocket/7.0.0 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11\" }, \"json\": null, \"origin\": \"155.94.127.118, 155.94.127.118\", \"url\": \"https://httpbin.org/post\" }","title":"curl"},{"location":"ws/#connect","text":"The connect command connects to a websocket endpoint, and starts an interactive prompt. Line editing, such as using the direction keys to fetch the last thing you tried to type) is provided. That command is pretty useful to try to send random data to an endpoint and verify that the service handles it with grace (such as sending invalid json). ws connect wss://echo.websocket.org Type Ctrl-D to exit prompt... Connecting to url: wss://echo.websocket.org > ws_connect: connected Uri: / Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:38:44 GMT Sec-WebSocket-Accept: 2j6LBScZveqrMx1W/GJkCWvZo3M= sec-websocket-extensions: Server: Kaazing Gateway Upgrade: websocket Received ping Received ping Received ping Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! > Hello world ! > Received 13 bytes ws_connect: received message: Hello world ! ws connect 'ws://jeanserge.com/v2?appkey=_pubsub' Type Ctrl-D to exit prompt... Connecting to url: ws://jeanserge.com/v2?appkey=_pubsub > ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:28 GMT Sec-WebSocket-Accept: LYHmjh9Gsu/Yw7aumQqyPObOEV4= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket bababababababab > ws_connect: connection closed: code 1000 reason ws_connect: connected Uri: /v2?appkey=_pubsub Handshake Headers: Connection: Upgrade Date: Tue, 08 Oct 2019 21:45:44 GMT Sec-WebSocket-Accept: I1rqxdLgTU+opPi5/zKPBTuXdLw= Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 Server: Python/3.7 websockets/8.0.2 Upgrade: websocket It is possible to pass custom HTTP header when doing the connection handshake, the remote server might process them to implement a simple authorization scheme. src$ ws connect -H Authorization:supersecret ws://localhost:8008 Type Ctrl-D to exit prompt... [2020-12-17 22:35:08.732] [info] Authorization: supersecret Connecting to url: ws://localhost:8008 > [2020-12-17 22:35:08.736] [info] ws_connect: connected [2020-12-17 22:35:08.736] [info] Uri: / [2020-12-17 22:35:08.736] [info] Headers: [2020-12-17 22:35:08.736] [info] Connection: Upgrade [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Accept: 2yaTFcdwn8KL6IzSMj2u6Le7KTg= [2020-12-17 22:35:08.736] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.736] [info] Server: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:08.736] [info] Upgrade: websocket [2020-12-17 22:35:08.736] [info] Received 25 bytes ws_connect: received message: Authorization suceeded! [2020-12-17 22:35:08.736] [info] Received pong ixwebsocket::heartbeat::30s::0 hello > [2020-12-17 22:35:25.157] [info] Received 7 bytes ws_connect: received message: hello If the wrong header is passed in, the server would close the connection with a custom close code (>4000, and <4999). [2020-12-17 22:39:37.044] [info] Upgrade: websocket ws_connect: connection closed: code 4001 reason Permission denied","title":"connect"},{"location":"ws/#echo-server","text":"The ws echo server will respond what the client just sent him. If we use the simple --http_authorization_header we can enforce that client need to pass a special value in the Authorization header to connect. $ ws echo_server --http_authorization_header supersecret [2020-12-17 22:35:06.192] [info] Listening on 127.0.0.1:8008 [2020-12-17 22:35:08.735] [info] New connection [2020-12-17 22:35:08.735] [info] remote ip: 127.0.0.1 [2020-12-17 22:35:08.735] [info] id: 0 [2020-12-17 22:35:08.735] [info] Uri: / [2020-12-17 22:35:08.735] [info] Headers: [2020-12-17 22:35:08.735] [info] Authorization: supersecret [2020-12-17 22:35:08.735] [info] Connection: Upgrade [2020-12-17 22:35:08.735] [info] Host: localhost:8008 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15 [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Key: eFF2Gf25dC7eC15Ab1135G== [2020-12-17 22:35:08.735] [info] Sec-WebSocket-Version: 13 [2020-12-17 22:35:08.735] [info] Upgrade: websocket [2020-12-17 22:35:08.735] [info] User-Agent: ixwebsocket/11.0.4 macos ssl/SecureTransport zlib 1.2.11 [2020-12-17 22:35:25.157] [info] Received 7 bytes","title":"echo server"},{"location":"ws/#websocket-proxy","text":"ws proxy_server --remote_host ws://127.0.0.1:9000 -v Listening on 127.0.0.1:8008 If you connect to ws://127.0.0.1:8008, the proxy will connect to ws://127.0.0.1:9000 and pass all traffic to this server. You can also use a more complex setup if you want to redirect to different websocket servers based on the hostname your client is trying to connect to. If you have multiple CNAME aliases that point to the same server. A JSON config file is used to express that mapping ; here connecting to echo.jeanserge.com will proxy the client to ws://localhost:8008 on the local machine (which actually runs ws echo_server), while connecting to bavarde.jeanserge.com will proxy the client to ws://localhost:5678 where a cobra python server is running. As a side note you will need a wildcard SSL certificate if you want to have SSL enabled on that machine. echo.jeanserge.com=ws://localhost:8008 bavarde.jeanserge.com=ws://localhost:5678 The --config_path option is required to instruct ws proxy_server to read that file. ws proxy_server --config_path proxyConfig.json --port 8765","title":"Websocket proxy"},{"location":"ws/#file-transfer","text":"# Start transfer server, which is just a broadcast server at this point ws transfer # running on port 8080. # Start receiver first ws receive ws://localhost:8080 # Then send a file. File will be received and written to disk by the receiver process ws send ws://localhost:8080 /file/to/path","title":"File transfer"},{"location":"ws/#http-client","text":"$ ws curl --help HTTP Client Usage: ws curl [OPTIONS] url Positionals: url TEXT REQUIRED Connection url Options: -h,--help Print this help message and exit -d TEXT Form data -F TEXT Form data -H TEXT Header --output TEXT Output file -I Send a HEAD request -L Follow redirects --max-redirects INT Max Redirects -v Verbose -O Save output to disk --compress Enable gzip compression --connect-timeout INT Connection timeout --transfer-timeout INT Transfer timeout","title":"HTTP Client"}]}
\ No newline at end of file
diff --git a/sitemap.xml.gz b/sitemap.xml.gz
index 7423878a..d106b203 100644
Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ