Deployed 847fc14 with MkDocs version: 1.1.2

This commit is contained in:
2020-07-25 18:43:04 +00:00
parent 9e0825127d
commit b47cb43419
5 changed files with 44 additions and 29 deletions

View File

@ -95,6 +95,10 @@
<li class="nav-item" data-level="1"><a href="#changelog" class="nav-link">Changelog</a> <li class="nav-item" data-level="1"><a href="#changelog" class="nav-link">Changelog</a>
<ul class="nav flex-column"> <ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#1000-2020-07-25" class="nav-link">[10.0.0] - 2020-07-25</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#9107-2020-07-25" class="nav-link">[9.10.7] - 2020-07-25</a> <li class="nav-item" data-level="2"><a href="#9107-2020-07-25" class="nav-link">[9.10.7] - 2020-07-25</a>
<ul class="nav flex-column"> <ul class="nav flex-column">
</ul> </ul>
@ -880,6 +884,8 @@
<h1 id="changelog">Changelog</h1> <h1 id="changelog">Changelog</h1>
<p>All changes to this project will be documented in this file.</p> <p>All changes to this project will be documented in this file.</p>
<h2 id="1000-2020-07-25">[10.0.0] - 2020-07-25</h2>
<p>(ixwebsocket server) change legacy api with 2 nested callbacks, so that the first api takes a weak_ptr<WebSocket> as its first argument</p>
<h2 id="9107-2020-07-25">[9.10.7] - 2020-07-25</h2> <h2 id="9107-2020-07-25">[9.10.7] - 2020-07-25</h2>
<p>(ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better.</p> <p>(ixwebsocket) add WebSocketProxyServer, from ws. Still need to make the interface better.</p>
<h2 id="9106-2020-07-24">[9.10.6] - 2020-07-24</h2> <h2 id="9106-2020-07-24">[9.10.6] - 2020-07-24</h2>

View File

@ -262,5 +262,5 @@ webSocket.send(&quot;hello world&quot;);
<!-- <!--
MkDocs version : 1.1.2 MkDocs version : 1.1.2
Build Date UTC : 2020-07-25 18:26:57.024903+00:00 Build Date UTC : 2020-07-25 18:43:04.491489+00:00
--> -->

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -331,6 +331,7 @@ uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
<h2 id="websocket-server-api">WebSocket server API</h2> <h2 id="websocket-server-api">WebSocket server API</h2>
<h3 id="legacy-api">Legacy api</h3> <h3 id="legacy-api">Legacy api</h3>
<p>This api was actually changed to take a weak_ptr<WebSocket> as the first argument to setOnConnectionCallback ; previously it would take a shared_ptr<WebSocket> which was creating cycles and then memory leaks problems.</p>
<pre><code class="cpp">#include &lt;ixwebsocket/IXWebSocketServer.h&gt; <pre><code class="cpp">#include &lt;ixwebsocket/IXWebSocketServer.h&gt;
... ...
@ -340,13 +341,16 @@ uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
ix::WebSocketServer server(port); ix::WebSocketServer server(port);
server.setOnConnectionCallback( server.setOnConnectionCallback(
[&amp;server](std::shared_ptr&lt;WebSocket&gt; webSocket, [&amp;server](std::weak_ptr&lt;WebSocket&gt; webSocket,
std::shared_ptr&lt;ConnectionState&gt; connectionState, std::shared_ptr&lt;ConnectionState&gt; connectionState,
std::unique_ptr&lt;ConnectionInfo&gt; connectionInfo) std::unique_ptr&lt;ConnectionInfo&gt; connectionInfo)
{ {
std::cout &lt;&lt; &quot;Remote ip: &quot; &lt;&lt; connectionInfo-&gt;remoteIp &lt;&lt; std::endl; std::cout &lt;&lt; &quot;Remote ip: &quot; &lt;&lt; connectionInfo-&gt;remoteIp &lt;&lt; std::endl;
webSocket-&gt;setOnMessageCallback( auto ws = webSocket.lock();
if (ws)
{
ws-&gt;setOnMessageCallback(
[webSocket, connectionState, &amp;server](const ix::WebSocketMessagePtr msg) [webSocket, connectionState, &amp;server](const ix::WebSocketMessagePtr msg)
{ {
if (msg-&gt;type == ix::WebSocketMessageType::Open) if (msg-&gt;type == ix::WebSocketMessageType::Open)
@ -374,7 +378,12 @@ server.setOnConnectionCallback(
// All connected clients are available in an std::set. See the broadcast cpp example. // 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. // 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. // Here we send it in the same mode as it was received.
webSocket-&gt;send(msg-&gt;str, msg-&gt;binary); auto ws = webSocket.lock();
if (ws)
{
ws-&gt;send(msg-&gt;str, msg-&gt;binary);
}
}
} }
} }
); );