Deployed 49d1e84 with MkDocs version: 1.1
This commit is contained in:
1 parent
6c443ee5c5
commit
42f761cceb
4 files changed
+32
-27
No files matched your search
+2
-2
@@ -114,7 +114,7 @@
|
|||||||
</div></div>
|
</div></div>
|
||||||
<div class="col-md-9" role="main">
|
<div class="col-md-9" role="main">
|
||||||
|
|
||||||
<p><img alt="Alt text" src="https://travis-ci.org/machinezone/IXWebSocket.svg?branch=master" /></p>
|
<p><img alt="Build status" src="https://github.com/machinezone/IXWebSocket/workflows/unittest/badge.svg" /></p>
|
||||||
<h2 id="introduction">Introduction</h2>
|
<h2 id="introduction">Introduction</h2>
|
||||||
<p><a href="https://en.wikipedia.org/wiki/WebSocket"><em>WebSocket</em></a> is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. <em>IXWebSocket</em> is a C++ library for client and server Websocket communication, and for client and server HTTP communication. <em>TLS</em> aka <em>SSL</em> is supported. The code is derived from <a href="https://github.com/dhbaird/easywsclient">easywsclient</a> and from the <a href="https://github.com/satori-com/satori-rtm-sdk-c">Satori C SDK</a>. It has been tested on the following platforms.</p>
|
<p><a href="https://en.wikipedia.org/wiki/WebSocket"><em>WebSocket</em></a> is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. <em>IXWebSocket</em> is a C++ library for client and server Websocket communication, and for client and server HTTP communication. <em>TLS</em> aka <em>SSL</em> is supported. The code is derived from <a href="https://github.com/dhbaird/easywsclient">easywsclient</a> and from the <a href="https://github.com/satori-com/satori-rtm-sdk-c">Satori C SDK</a>. It has been tested on the following platforms.</p>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -240,5 +240,5 @@ webSocket.send("hello world");
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
MkDocs version : 1.1
|
MkDocs version : 1.1
|
||||||
Build Date UTC : 2020-03-17 15:47:59
|
Build Date UTC : 2020-03-17 17:09:52
|
||||||
-->
|
-->
|
||||||
@@ -1 +1 @@
|
|||||||
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Introduction WebSocket is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. IXWebSocket is a C++ library for client and server Websocket communication, and for client and server HTTP communication. TLS aka SSL is supported. The code is derived from easywsclient and from the Satori C SDK . It has been tested on the following platforms. macOS iOS Linux Android Windows FreeBSD Example code // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // 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\"); Why another library? There are 2 main reasons that explain why IXWebSocket got written. First, we needed a C++ cross-platform client library, which should have few dependencies. What looked like the most solid one, websocketpp did depend on boost and this was not an option for us. Secondly, there were other available libraries with fewer dependencies (C ones), but they required calling an explicit poll routine periodically to know if a client had received data from a server, which was not elegant. We started by solving those 2 problems, then we added server websocket code, then an HTTP client, and finally a very simple HTTP server. Contributing IXWebSocket is developed on GitHub . We'd love to hear about how you use it; opening up an issue on GitHub is ok for that. 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.","title":"Home"},{"location":"#introduction","text":"WebSocket is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. IXWebSocket is a C++ library for client and server Websocket communication, and for client and server HTTP communication. TLS aka SSL is supported. The code is derived from easywsclient and from the Satori C SDK . It has been tested on the following platforms. macOS iOS Linux Android Windows FreeBSD","title":"Introduction"},{"location":"#example-code","text":"// Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // 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\");","title":"Example code"},{"location":"#why-another-library","text":"There are 2 main reasons that explain why IXWebSocket got written. First, we needed a C++ cross-platform client library, which should have few dependencies. What looked like the most solid one, websocketpp did depend on boost and this was not an option for us. Secondly, there were other available libraries with fewer dependencies (C ones), but they required calling an explicit poll routine periodically to know if a client had received data from a server, which was not elegant. We started by solving those 2 problems, then we added server websocket code, then an HTTP client, and finally a very simple HTTP server.","title":"Why another library?"},{"location":"#contributing","text":"IXWebSocket is developed on GitHub . We'd love to hear about how you use it; opening up an issue on GitHub is ok for that. 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.","title":"Contributing"},{"location":"CHANGELOG/","text":"Changelog All changes to this project will be documented in this file. [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 hLine truncated
|
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Introduction WebSocket is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. IXWebSocket is a C++ library for client and server Websocket communication, and for client and server HTTP communication. TLS aka SSL is supported. The code is derived from easywsclient and from the Satori C SDK . It has been tested on the following platforms. macOS iOS Linux Android Windows FreeBSD Example code // Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // 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\"); Why another library? There are 2 main reasons that explain why IXWebSocket got written. First, we needed a C++ cross-platform client library, which should have few dependencies. What looked like the most solid one, websocketpp did depend on boost and this was not an option for us. Secondly, there were other available libraries with fewer dependencies (C ones), but they required calling an explicit poll routine periodically to know if a client had received data from a server, which was not elegant. We started by solving those 2 problems, then we added server websocket code, then an HTTP client, and finally a very simple HTTP server. Contributing IXWebSocket is developed on GitHub . We'd love to hear about how you use it; opening up an issue on GitHub is ok for that. 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.","title":"Home"},{"location":"#introduction","text":"WebSocket is a computer communications protocol, providing full-duplex and bi-directionnal communication channels over a single TCP connection. IXWebSocket is a C++ library for client and server Websocket communication, and for client and server HTTP communication. TLS aka SSL is supported. The code is derived from easywsclient and from the Satori C SDK . It has been tested on the following platforms. macOS iOS Linux Android Windows FreeBSD","title":"Introduction"},{"location":"#example-code","text":"// Required on Windows ix::initNetSystem(); // Our websocket object ix::WebSocket webSocket; std::string url(\"ws://localhost:8080/\"); webSocket.setUrl(url); // 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\");","title":"Example code"},{"location":"#why-another-library","text":"There are 2 main reasons that explain why IXWebSocket got written. First, we needed a C++ cross-platform client library, which should have few dependencies. What looked like the most solid one, websocketpp did depend on boost and this was not an option for us. Secondly, there were other available libraries with fewer dependencies (C ones), but they required calling an explicit poll routine periodically to know if a client had received data from a server, which was not elegant. We started by solving those 2 problems, then we added server websocket code, then an HTTP client, and finally a very simple HTTP server.","title":"Why another library?"},{"location":"#contributing","text":"IXWebSocket is developed on GitHub . We'd love to hear about how you use it; opening up an issue on GitHub is ok for that. 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.","title":"Contributing"},{"location":"CHANGELOG/","text":"Changelog All changes to this project will be documented in this file. [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 hLine truncated
|
||||||
Binary file not shown.
+29
-24
@@ -111,6 +111,10 @@
|
|||||||
<li class="nav-item" data-level="2"><a href="#http-server-api" class="nav-link">HTTP server API</a>
|
<li class="nav-item" data-level="2"><a href="#http-server-api" class="nav-link">HTTP server API</a>
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
</ul>
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" data-level="2"><a href="#tls-support-and-configuration" class="nav-link">TLS support and configuration</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -322,29 +326,6 @@ Wait time(ms): 10000
|
|||||||
uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
|
uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h3 id="tls-support-and-configuration">TLS support and configuration</h3>
|
|
||||||
<p>To leverage TLS features, the library must be compiled with the option <code>USE_TLS=1</code>.</p>
|
|
||||||
<p>Then, secure sockets are automatically used when connecting to a <code>wss://*</code> url.</p>
|
|
||||||
<p>Additional TLS options can be configured by passing a <code>ix::SocketTLSOptions</code> instance to the
|
|
||||||
<code>setTLSOptions</code> on <code>ix::WebSocket</code> (or <code>ix::WebSocketServer</code> or <code>ix::HttpServer</code>)</p>
|
|
||||||
<pre><code class="cpp">webSocket.setTLSOptions({
|
|
||||||
.certFile = "path/to/cert/file.pem",
|
|
||||||
.keyFile = "path/to/key/file.pem",
|
|
||||||
.caFile = "path/to/trust/bundle/file.pem",
|
|
||||||
.tls = true // required in server mode
|
|
||||||
});
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Specifying <code>certFile</code> and <code>keyFile</code> configures the certificate that will be used to communicate with TLS peers.</p>
|
|
||||||
<p>On a client, this is only necessary for connecting to servers that require a client certificate.</p>
|
|
||||||
<p>On a server, this is necessary for TLS support.</p>
|
|
||||||
<p>Specifying <code>caFile</code> configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates.
|
|
||||||
- The special value of <code>SYSTEM</code> (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 <code>NONE</code> can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity.</p>
|
|
||||||
<p>For a client, specifying <code>caFile</code> can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment.</p>
|
|
||||||
<p>For a server, specifying <code>caFile</code> implies that:
|
|
||||||
1. You require clients to present a certificate
|
|
||||||
1. It must be signed by one of the trusted roots in the file</p>
|
|
||||||
<h2 id="websocket-server-api">WebSocket server API</h2>
|
<h2 id="websocket-server-api">WebSocket server API</h2>
|
||||||
<pre><code class="cpp">#include <ixwebsocket/IXWebSocketServer.h>
|
<pre><code class="cpp">#include <ixwebsocket/IXWebSocketServer.h>
|
||||||
|
|
||||||
@@ -523,7 +504,31 @@ server.wait();
|
|||||||
WebSocketHttpHeaders(),
|
WebSocketHttpHeaders(),
|
||||||
content);
|
content);
|
||||||
}
|
}
|
||||||
</code></pre></div>
|
</code></pre>
|
||||||
|
|
||||||
|
<h2 id="tls-support-and-configuration">TLS support and configuration</h2>
|
||||||
|
<p>To leverage TLS features, the library must be compiled with the option <code>USE_TLS=1</code>.</p>
|
||||||
|
<p>Then, secure sockets are automatically used when connecting to a <code>wss://*</code> url.</p>
|
||||||
|
<p>Additional TLS options can be configured by passing a <code>ix::SocketTLSOptions</code> instance to the
|
||||||
|
<code>setTLSOptions</code> on <code>ix::WebSocket</code> (or <code>ix::WebSocketServer</code> or <code>ix::HttpServer</code>)</p>
|
||||||
|
<pre><code class="cpp">webSocket.setTLSOptions({
|
||||||
|
.certFile = "path/to/cert/file.pem",
|
||||||
|
.keyFile = "path/to/key/file.pem",
|
||||||
|
.caFile = "path/to/trust/bundle/file.pem",
|
||||||
|
.tls = true // required in server mode
|
||||||
|
});
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
<p>Specifying <code>certFile</code> and <code>keyFile</code> configures the certificate that will be used to communicate with TLS peers.</p>
|
||||||
|
<p>On a client, this is only necessary for connecting to servers that require a client certificate.</p>
|
||||||
|
<p>On a server, this is necessary for TLS support.</p>
|
||||||
|
<p>Specifying <code>caFile</code> configures the trusted roots bundle file (in PEM format) that will be used to verify peer certificates.
|
||||||
|
- The special value of <code>SYSTEM</code> (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 <code>NONE</code> can be used to disable peer verification; this is only recommended to rule out certificate verification when testing connectivity.</p>
|
||||||
|
<p>For a client, specifying <code>caFile</code> can be used if connecting to a server that uses a self-signed cert, or when using a custom CA in an internal environment.</p>
|
||||||
|
<p>For a server, specifying <code>caFile</code> implies that:
|
||||||
|
1. You require clients to present a certificate
|
||||||
|
1. It must be signed by one of the trusted roots in the file</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user