Deployed bfe0212 with MkDocs version: 1.0.4

This commit is contained in:
Benjamin Sergeant 2019-12-03 09:28:36 -08:00
parent 8ac11111d1
commit 3a77248222
10 changed files with 45 additions and 40 deletions

View File

@ -94,6 +94,7 @@
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="main active"><a href="#changelog">Changelog</a></li>
<li><a href="#743-2019-12-03">[7.4.3] - 2019-12-03</a></li>
<li><a href="#742-2019-12-02">[7.4.2] - 2019-12-02</a></li>
<li><a href="#741-2019-12-02">[7.4.1] - 2019-12-02</a></li>
<li><a href="#740-2019-11-25">[7.4.0] - 2019-11-25</a></li>
@ -153,6 +154,10 @@
<h1 id="changelog">Changelog</h1>
<p>All notable changes to this project will be documented in this file.</p>
<h2 id="743-2019-12-03">[7.4.3] - 2019-12-03</h2>
<ul>
<li>(http client) use std::unordered_map instead of std::map for HttpParameters and HttpFormDataParameters class aliases</li>
</ul>
<h2 id="742-2019-12-02">[7.4.2] - 2019-12-02</h2>
<ul>
<li>(client) internal IXDNSLookup class requires a valid cancellation request function callback to be passed in</li>

View File

@ -127,7 +127,7 @@ There is a unittest which can be executed by typing <code>make test</code>.</p>
</code></pre>
<h3 id="conan">Conan</h3>
<p>Support for building with conan was contributed by Olivia Zoe (thanks !). The package name to reference is <code>IXWebSocket/5.0.0@LunarWatcher/stable</code>. The package is in the process to be published to the official conan package repo, but in the meantime, it can be accessed by adding a new remote</p>
<p>Support for building with conan was contributed by Olivia Zoe (thanks!). The package name to reference is <code>IXWebSocket/5.0.0@LunarWatcher/stable</code>, and a list of the uploaded versions is available on <a href="https://bintray.com/oliviazoe0/conan-packages/IXWebSocket%3ALunarWatcher">Bintray</a>. The package is in the process to be published to the official conan package repo, but in the meantime, it can be accessed by adding a new remote</p>
<pre><code>conan remote add remote_name_here https://api.bintray.com/conan/oliviazoe0/conan-packages
</code></pre>

View File

@ -106,7 +106,7 @@
<p>Bring up 3 terminals and run a server, a publisher and a subscriber in each one. As you publish data you should see it being received by the subscriber. You can run <code>redis-cli MONITOR</code> too to see how redis is being used.</p>
<h3 id="server">Server</h3>
<p>You will need to have a redis server running locally. To run the server:</p>
<pre><code>$ cd &lt;ixwebsocket-top-level-folder&gt;/ixsnake/ixsnake
<pre><code class="bash">$ cd &lt;ixwebsocket-top-level-folder&gt;/ixsnake/ixsnake
$ ws snake
{
&quot;apps&quot;: {
@ -129,7 +129,7 @@ redis port: 6379
</code></pre>
<h3 id="publisher">Publisher</h3>
<pre><code>$ cd &lt;ixwebsocket-top-level-folder&gt;/ws
<pre><code class="bash">$ cd &lt;ixwebsocket-top-level-folder&gt;/ws
$ ws cobra_publish --appkey FC2F10139A2BAc53BB72D9db967b024f --endpoint ws://127.0.0.1:8008 --rolename _pub --rolesecret 1c04DB8fFe76A4EeFE3E318C72d771db test_channel cobraMetricsSample.json
[2019-11-27 09:06:12.980] [info] Publisher connected
[2019-11-27 09:06:12.980] [info] Connection: Upgrade
@ -143,7 +143,7 @@ $ ws cobra_publish --appkey FC2F10139A2BAc53BB72D9db967b024f --endpoint ws://127
</code></pre>
<h3 id="subscriber">Subscriber</h3>
<pre><code>$ ws cobra_subscribe --appkey FC2F10139A2BAc53BB72D9db967b024f --endpoint ws://127.0.0.1:8008 --rolename _pub --rolesecret 1c04DB8fFe76A4EeFE3E318C72d771db test_channel
<pre><code class="bash">$ ws cobra_subscribe --appkey FC2F10139A2BAc53BB72D9db967b024f --endpoint ws://127.0.0.1:8008 --rolename _pub --rolesecret 1c04DB8fFe76A4EeFE3E318C72d771db test_channel
#messages 0 msg/s 0
[2019-11-27 09:07:39.341] [info] Subscriber connected
[2019-11-27 09:07:39.341] [info] Connection: Upgrade

View File

@ -119,7 +119,7 @@
<p>Large frames are broken up into smaller chunks or messages to avoid filling up the os tcp buffers, which is permitted thanks to WebSocket <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmentation</a>. Messages up to 1G were sent and received succesfully.</p>
<h3 id="testing">Testing</h3>
<p>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.</p>
<p>The unittest tries to be comprehensive, and has been running on multiple platoform, with different sanitizers such as thread sanitizer to catch data races or the undefined behavior sanitizer.</p>
<p>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.</p>
<p>The regression test is running after each commit on travis.</p>
<h2 id="limitations">Limitations</h2>
<ul>

View File

@ -95,7 +95,7 @@
<ul class="nav bs-sidenav">
<li class="main active"><a href="#introduction">Introduction</a></li>
<li class="main "><a href="#example-code">Example code</a></li>
<li class="main "><a href="#why-another-library">Why another library ?</a></li>
<li class="main "><a href="#why-another-library">Why another library?</a></li>
<li class="main "><a href="#contributing">Contributing</a></li>
</ul>
</div></div>
@ -113,10 +113,10 @@
<li>FreeBSD</li>
</ul>
<h2 id="example-code">Example code</h2>
<pre><code># Required on Windows
<pre><code class="cpp">// Required on Windows
ix::initNetSystem();
# Our websocket object
// Our websocket object
ix::WebSocket webSocket;
std::string url(&quot;ws://localhost:8080/&quot;);
@ -139,11 +139,11 @@ webSocket.start();
webSocket.send(&quot;hello world&quot;);
</code></pre>
<h2 id="why-another-library">Why another library ?</h2>
<h2 id="why-another-library">Why another library?</h2>
<p>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, <a href="https://github.com/zaphoyd/websocketpp">websocketpp</a> 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.</p>
<p>We started by solving those 2 problems, then we added server websocket code, then an HTTP client, and finally a very simple HTTP server.</p>
<h2 id="contributing">Contributing</h2>
<p>IXWebSocket is developed on <a href="https://github.com/machinezone/IXWebSocket">github</a>. We'd love to hear about how you use it ; opening up an issue in github is ok for that. If things don't work as expected, please create an issue in github, or even better a pull request if you know how to fix your problem.</p></div>
<p>IXWebSocket is developed on <a href="https://github.com/machinezone/IXWebSocket">GitHub</a>. 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.</p></div>
</div>
<footer class="col-md-12">
@ -226,5 +226,5 @@ webSocket.send(&quot;hello world&quot;);
<!--
MkDocs version : 1.0.4
Build Date UTC : 2019-12-02 22:52:27
Build Date UTC : 2019-12-03 17:28:36
-->

File diff suppressed because one or more lines are too long

View File

@ -2,37 +2,37 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>None</loc>
<lastmod>2019-12-02</lastmod>
<lastmod>2019-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

View File

@ -107,7 +107,7 @@
<p>The <a href="https://github.com/machinezone/IXWebSocket/tree/master/ws"><em>ws</em></a> folder countains many interactive programs for chat, <a href="https://github.com/machinezone/IXWebSocket/blob/master/ws/ws_send.cpp">file transfers</a>, <a href="https://github.com/machinezone/IXWebSocket/blob/master/ws/ws_http_client.cpp">curl like</a> http clients, demonstrating client and server usage.</p>
<h2 id="windows-note">Windows note</h2>
<p>To use the network system on Windows, you need to initialize it once with <em>WSAStartup()</em> and clean it up with <em>WSACleanup()</em>. We have helpers for that which you can use, see below. This init would typically take place in your main function.</p>
<pre><code>#include &lt;ixwebsocket/IXNetSystem.h&gt;
<pre><code class="cpp">#include &lt;ixwebsocket/IXNetSystem.h&gt;
int main()
{
@ -121,11 +121,11 @@ int main()
</code></pre>
<h2 id="websocket-client-api">WebSocket client API</h2>
<pre><code>#include &lt;ixwebsocket/IXWebSocket.h&gt;
<pre><code class="cpp">#include &lt;ixwebsocket/IXWebSocket.h&gt;
...
# Our websocket object
// Our websocket object
ix::WebSocket webSocket;
std::string url(&quot;ws://localhost:8080/&quot;);
@ -175,8 +175,8 @@ webSocket.stop()
<li>ReadyState::Closed - The connection is closed or could not be opened.</li>
</ol>
<h3 id="open-and-close-notifications">Open and Close notifications</h3>
<p>The onMessage event will be fired when the connection is opened or closed. This is similar to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket">Javascript browser API</a>, which has <code>open</code> and <code>close</code> events notification that can be registered with the browser <code>addEventListener</code>.</p>
<pre><code>webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
<p>The onMessage event will be fired when the connection is opened or closed. This is similar to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket">JavaScript browser API</a>, which has <code>open</code> and <code>close</code> events notification that can be registered with the browser <code>addEventListener</code>.</p>
<pre><code class="cpp">webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
{
if (msg-&gt;type == ix::WebSocketMessageType::Open)
{
@ -204,7 +204,7 @@ webSocket.stop()
<h3 id="error-notification">Error notification</h3>
<p>A message will be fired when there is an error with the connection. The message type will be <code>ix::WebSocketMessageType::Error</code>. Multiple fields will be available on the event to describe the error.</p>
<pre><code>webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
<pre><code class="cpp">webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
{
if (msg-&gt;type == ix::WebSocketMessageType::Error)
{
@ -226,13 +226,13 @@ webSocket.stop()
</ol>
<h3 id="configuring-the-remote-url">Configuring the remote url</h3>
<p>The url can be set and queried after a websocket object has been created. You will have to call <code>stop</code> and <code>start</code> if you want to disconnect and connect to that new url.</p>
<pre><code>std::string url(&quot;wss://example.com&quot;);
<pre><code class="cpp">std::string url(&quot;wss://example.com&quot;);
websocket.configure(url);
</code></pre>
<h3 id="pingpong-support">Ping/Pong support</h3>
<p>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.</p>
<pre><code>webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
<pre><code class="cpp">webSocket.setOnMessageCallback([](const ix::WebSocketMessagePtr&amp; msg)
{
if (msg-&gt;type == ix::WebSocketMessageType::Ping ||
msg-&gt;type == ix::WebSocketMessageType::Pong)
@ -244,36 +244,36 @@ websocket.configure(url);
</code></pre>
<p>A ping message can be sent to the server, with an optional data string.</p>
<pre><code>websocket.ping(&quot;ping data, optional (empty string is ok): limited to 125 bytes long&quot;);
<pre><code class="cpp">websocket.ping(&quot;ping data, optional (empty string is ok): limited to 125 bytes long&quot;);
</code></pre>
<h3 id="heartbeat">Heartbeat.</h3>
<p>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.</p>
<pre><code>webSocket.setHeartBeatPeriod(45);
<pre><code class="cpp">webSocket.setHeartBeatPeriod(45);
</code></pre>
<h3 id="supply-extra-http-headers">Supply extra HTTP headers.</h3>
<p>You can set extra HTTP headers to be sent during the WebSocket handshake.</p>
<pre><code>WebSocketHttpHeaders headers;
<pre><code class="cpp">WebSocketHttpHeaders headers;
headers[&quot;foo&quot;] = &quot;bar&quot;;
webSocket.setExtraHeaders(headers);
</code></pre>
<h3 id="subprotocols">Subprotocols</h3>
<p>You can specify subprotocols to be set during the WebSocket handshake. For more info you can refer to <a href="https://hpbn.co/websocket/#subprotocol-negotiation">this doc</a>.</p>
<pre><code>webSocket.addSubprotocol(&quot;appProtocol-v1&quot;);
<pre><code class="cpp">webSocket.addSubprotocol(&quot;appProtocol-v1&quot;);
webSocket.addSubprotocol(&quot;appProtocol-v2&quot;);
</code></pre>
<p>The protocol that the server did accept is available in the open info <code>protocol</code> field.</p>
<pre><code>std::cout &lt;&lt; &quot;protocol: &quot; &lt;&lt; msg-&gt;openInfo.protocol &lt;&lt; std::endl;
<pre><code class="cpp">std::cout &lt;&lt; &quot;protocol: &quot; &lt;&lt; msg-&gt;openInfo.protocol &lt;&lt; std::endl;
</code></pre>
<h3 id="automatic-reconnection">Automatic reconnection</h3>
<p>Automatic reconnection kicks in when the connection is disconnected without the user consent. This feature is on by default and can be turned off.</p>
<pre><code>webSocket.enableAutomaticReconnection(); // turn on
<pre><code class="cpp">webSocket.enableAutomaticReconnection(); // turn on
webSocket.disableAutomaticReconnection(); // turn off
bool enabled = webSocket.isAutomaticReconnectionEnabled(); // query state
</code></pre>
@ -302,7 +302,7 @@ Wait time(ms): 10000
</code></pre>
<p>The waiting time is capped by default at 10s between 2 attempts, but that value can be changed and queried.</p>
<pre><code>webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s
<pre><code class="cpp">webSocket.setMaxWaitBetweenReconnectionRetries(5 * 1000); // 5000ms = 5s
uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
</code></pre>
@ -311,7 +311,7 @@ uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
<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>webSocket.setTLSOptions({
<pre><code class="cpp">webSocket.setTLSOptions({
.certFile = &quot;path/to/cert/file.pem&quot;,
.keyFile = &quot;path/to/key/file.pem&quot;,
.caFile = &quot;path/to/trust/bundle/file.pem&quot;
@ -329,7 +329,7 @@ uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
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>
<pre><code>#include &lt;ixwebsocket/IXWebSocketServer.h&gt;
<pre><code class="cpp">#include &lt;ixwebsocket/IXWebSocketServer.h&gt;
...
@ -392,7 +392,7 @@ server.wait();
</code></pre>
<h2 id="http-client-api">HTTP client API</h2>
<pre><code>#include &lt;ixwebsocket/IXHttpClient.h&gt;
<pre><code class="cpp">#include &lt;ixwebsocket/IXHttpClient.h&gt;
...
@ -473,7 +473,7 @@ bool ok = httpClient.performRequest(args, [](const HttpResponsePtr&amp; response
</code></pre>
<h2 id="http-server-api">HTTP server API</h2>
<pre><code>#include &lt;ixwebsocket/IXHttpServer.h&gt;
<pre><code class="cpp">#include &lt;ixwebsocket/IXHttpServer.h&gt;
ix::HttpServer server(port, hostname);
@ -489,7 +489,7 @@ server.wait();
</code></pre>
<p>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.</p>
<pre><code>setOnConnectionCallback(
<pre><code class="cpp">setOnConnectionCallback(
[this](HttpRequestPtr request,
std::shared_ptr&lt;ConnectionState&gt; /*connectionState*/) -&gt; HttpResponsePtr
{

View File

@ -328,7 +328,7 @@ Options:
</code></pre>
<h2 id="cobra-client">Cobra Client</h2>
<p><a href="https://github.com/machinezone/cobra">cobra</a> is a real time messenging server. ws has sub-command to interacti with cobra.</p></div>
<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>
</div>
<footer class="col-md-12">