Deployed 5222190 with MkDocs version: 1.0.4

This commit is contained in:
Benjamin Sergeant committed 2019-12-19 20:55:44 -08:00
1 parent e1a4a1d37c
commit bfc4c21574
6 files changed
+158 -12

No files matched your search

+35
View File
@@ -94,6 +94,15 @@
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary"> <div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav"> <ul class="nav bs-sidenav">
<li class="main active"><a href="#changelog">Changelog</a></li> <li class="main active"><a href="#changelog">Changelog</a></li>
<li><a href="#760-2019-12-19">[7.6.0] - 2019-12-19</a></li>
<li><a href="#758-2019-12-18">[7.5.8] - 2019-12-18</a></li>
<li><a href="#757-2019-12-18">[7.5.7] - 2019-12-18</a></li>
<li><a href="#756-2019-12-18">[7.5.6] - 2019-12-18</a></li>
<li><a href="#755-2019-12-17">[7.5.5] - 2019-12-17</a></li>
<li><a href="#754-2019-12-16">[7.5.4] - 2019-12-16</a></li>
<li><a href="#753-2019-12-12">[7.5.3] - 2019-12-12</a></li>
<li><a href="#752-2019-12-11">[7.5.2] - 2019-12-11</a></li>
<li><a href="#751-2019-12-06">[7.5.1] - 2019-12-06</a></li>
<li><a href="#750-2019-12-05">[7.5.0] - 2019-12-05</a></li> <li><a href="#750-2019-12-05">[7.5.0] - 2019-12-05</a></li>
<li><a href="#745-2019-12-03">[7.4.5] - 2019-12-03</a></li> <li><a href="#745-2019-12-03">[7.4.5] - 2019-12-03</a></li>
<li><a href="#744-2019-12-03">[7.4.4] - 2019-12-03</a></li> <li><a href="#744-2019-12-03">[7.4.4] - 2019-12-03</a></li>
@@ -157,6 +166,32 @@
<h1 id="changelog">Changelog</h1> <h1 id="changelog">Changelog</h1>
<p>All notable changes to this project will be documented in this file.</p> <p>All notable changes to this project will be documented in this file.</p>
<h2 id="760-2019-12-19">[7.6.0] - 2019-12-19</h2>
<p>(cobra) Add TLS options to all cobra commands and classes. Add example to the doc.</p>
<h2 id="758-2019-12-18">[7.5.8] - 2019-12-18</h2>
<p>(cobra-to-sentry) capture application version from device field</p>
<h2 id="757-2019-12-18">[7.5.7] - 2019-12-18</h2>
<p>(tls) Experimental TLS server support with mbedtls (windows) + process cert tlsoption (client + server)</p>
<h2 id="756-2019-12-18">[7.5.6] - 2019-12-18</h2>
<p>(tls servers) Make it clear that apple ssl and mbedtls backends do not support SSL in server mode</p>
<h2 id="755-2019-12-17">[7.5.5] - 2019-12-17</h2>
<p>(tls options client) TLSOptions struct _validated member should be initialized to false</p>
<h2 id="754-2019-12-16">[7.5.4] - 2019-12-16</h2>
<p>(websocket client) improve the error message when connecting to a non websocket server</p>
<p>Before:</p>
<pre><code>Connection error: Got bad status connecting to example.com:443, status: 200, HTTP Status line: HTTP/1.1 200 OK
</code></pre>
<p>After:</p>
<pre><code>Connection error: Expecting status 101 (Switching Protocol), got 200 status connecting to example.com:443, HTTP Status line: HTTP/1.1 200 OK
</code></pre>
<h2 id="753-2019-12-12">[7.5.3] - 2019-12-12</h2>
<p>(server) attempt at fixing #131 by using blocking writes in server mode</p>
<h2 id="752-2019-12-11">[7.5.2] - 2019-12-11</h2>
<p>(ws) cobra to sentry - created events with sentry tags based on tags present in the cobra messages</p>
<h2 id="751-2019-12-06">[7.5.1] - 2019-12-06</h2>
<p>(mac) convert SSL errors to utf8</p>
<h2 id="750-2019-12-05">[7.5.0] - 2019-12-05</h2> <h2 id="750-2019-12-05">[7.5.0] - 2019-12-05</h2>
<ul> <ul>
<li>(ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry.</li> <li>(ws) cobra to sentry. Handle Error 429 Too Many Requests and politely wait before sending more data to sentry.</li>
+1 -1
View File
@@ -226,5 +226,5 @@ webSocket.send(&quot;hello world&quot;);
<!-- <!--
MkDocs version : 1.0.4 MkDocs version : 1.0.4
Build Date UTC : 2019-12-05 23:59:42 Build Date UTC : 2019-12-20 04:55:44
--> -->
+1 -1
View File
@@ -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 notable changes to this project will be documented in this file. [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 [Line 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 notable changes to this project will be documented in this file. [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 (webLine truncated
+7 -7
View File
@@ -2,37 +2,37 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2019-12-05</lastmod> <lastmod>2019-12-19</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>
BIN
View File
Binary file not shown.
+114 -3
View File
@@ -99,7 +99,7 @@
<li class="main "><a href="#websocket-proxy">Websocket proxy</a></li> <li class="main "><a href="#websocket-proxy">Websocket proxy</a></li>
<li class="main "><a href="#file-transfer">File transfer</a></li> <li class="main "><a href="#file-transfer">File transfer</a></li>
<li class="main "><a href="#http-client">HTTP Client</a></li> <li class="main "><a href="#http-client">HTTP Client</a></li>
<li class="main "><a href="#cobra-client">Cobra Client</a></li> <li class="main "><a href="#cobra-client-and-server">Cobra client and server</a></li>
</ul> </ul>
</div></div> </div></div>
<div class="col-md-9" role="main"> <div class="col-md-9" role="main">
@@ -327,8 +327,119 @@ Options:
--transfer-timeout INT Transfer timeout --transfer-timeout INT Transfer timeout
</code></pre> </code></pre>
<h2 id="cobra-client">Cobra Client</h2> <h2 id="cobra-client-and-server">Cobra client and server</h2>
<p><a href="https://github.com/machinezone/cobra">cobra</a> is a real time messenging server. ws has a sub-command to interact with cobra.</p></div> <p><a href="https://github.com/machinezone/cobra">cobra</a> is a real time messenging server. ws has several sub-command to interact with cobra. There is also a minimal cobra compatible server named snake available.</p>
<p>Below are examples on running a snake server and clients with TLS enabled (the server only works with the OpenSSL backend for now).</p>
<p>First, generate certificates.</p>
<pre><code>$ cd /path/to/IXWebSocket
$ cd ixsnake/ixsnake
$ bash ../../ws/generate_certs.sh
Generating RSA private key, 2048 bit long modulus
.....+++
.................+++
e is 65537 (0x10001)
generated ./.certs/trusted-ca-key.pem
generated ./.certs/trusted-ca-crt.pem
Generating RSA private key, 2048 bit long modulus
..+++
.......................................+++
e is 65537 (0x10001)
generated ./.certs/trusted-server-key.pem
Signature ok
subject=/O=machinezone/O=IXWebSocket/CN=trusted-server
Getting CA Private Key
generated ./.certs/trusted-server-crt.pem
Generating RSA private key, 2048 bit long modulus
...................................+++
..................................................+++
e is 65537 (0x10001)
generated ./.certs/trusted-client-key.pem
Signature ok
subject=/O=machinezone/O=IXWebSocket/CN=trusted-client
Getting CA Private Key
generated ./.certs/trusted-client-crt.pem
Generating RSA private key, 2048 bit long modulus
..............+++
.......................................+++
e is 65537 (0x10001)
generated ./.certs/untrusted-ca-key.pem
generated ./.certs/untrusted-ca-crt.pem
Generating RSA private key, 2048 bit long modulus
..........+++
................................................+++
e is 65537 (0x10001)
generated ./.certs/untrusted-client-key.pem
Signature ok
subject=/O=machinezone/O=IXWebSocket/CN=untrusted-client
Getting CA Private Key
generated ./.certs/untrusted-client-crt.pem
Generating RSA private key, 2048 bit long modulus
.....................................................................................+++
...........+++
e is 65537 (0x10001)
generated ./.certs/selfsigned-client-key.pem
Signature ok
subject=/O=machinezone/O=IXWebSocket/CN=selfsigned-client
Getting Private key
generated ./.certs/selfsigned-client-crt.pem
</code></pre>
<p>Now run the snake server.</p>
<pre><code>$ export certs=.certs
$ ws snake --tls --port 8765 --cert-file ${certs}/trusted-server-crt.pem --key-file ${certs}/trusted-server-key.pem --ca-file ${certs}/trusted-ca-crt.pem
{
&quot;apps&quot;: {
&quot;FC2F10139A2BAc53BB72D9db967b024f&quot;: {
&quot;roles&quot;: {
&quot;_sub&quot;: {
&quot;secret&quot;: &quot;66B1dA3ED5fA074EB5AE84Dd8CE3b5ba&quot;
},
&quot;_pub&quot;: {
&quot;secret&quot;: &quot;1c04DB8fFe76A4EeFE3E318C72d771db&quot;
}
}
}
}
}
redis host: 127.0.0.1
redis password:
redis port: 6379
</code></pre>
<p>As a new connection comes in, such output should be printed</p>
<pre><code>[2019-12-19 20:27:19.724] [info] New connection
id: 0
Uri: /v2?appkey=_health
Headers:
Connection: Upgrade
Host: 127.0.0.1:8765
Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15
Sec-WebSocket-Key: d747B0fE61Db73f7Eh47c0==
Sec-WebSocket-Protocol: json
Sec-WebSocket-Version: 13
Upgrade: websocket
User-Agent: ixwebsocket/7.5.8 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11
</code></pre>
<p>To connect and publish a message, do:</p>
<pre><code>$ export certs=.certs
$ cd /path/to/ws/folder
$ ls cobraMetricsSample.json
cobraMetricsSample.json
$ ws cobra_publish --endpoint wss://127.0.0.1:8765 --appkey FC2F10139A2BAc53BB72D9db967b024f --rolename _pub --rolesecret 1c04DB8fFe76A4EeFE3E318C72d771db --channel foo --cert-file ${certs}/trusted-client-crt.pem --key-file ${certs}/trusted-client-key.pem --ca-file ${certs}/trusted-ca-crt.pem cobraMetricsSample.json
[2019-12-19 20:46:42.656] [info] Publisher connected
[2019-12-19 20:46:42.657] [info] Connection: Upgrade
[2019-12-19 20:46:42.657] [info] Sec-WebSocket-Accept: rs99IFThoBrhSg+k8G4ixH9yaq4=
[2019-12-19 20:46:42.657] [info] Sec-WebSocket-Extensions: permessage-deflate; server_max_window_bits=15; client_max_window_bits=15
[2019-12-19 20:46:42.657] [info] Server: ixwebsocket/7.5.8 macos ssl/OpenSSL OpenSSL 1.0.2q 20 Nov 2018 zlib 1.2.11
[2019-12-19 20:46:42.657] [info] Upgrade: websocket
[2019-12-19 20:46:42.658] [info] Publisher authenticated
[2019-12-19 20:46:42.658] [info] Published msg 3
[2019-12-19 20:46:42.659] [info] Published message id 3 acked
</code></pre>
<p>To use OpenSSL on macOS, compile with <code>make ws_openssl</code>. First you will have to install OpenSSL libraries, which can be done with Homebrew.</p></div>
</div> </div>
<footer class="col-md-12"> <footer class="col-md-12">