Deployed 2798886
with MkDocs version: 1.1.2
This commit is contained in:
@ -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="#9100-2020-07-23" class="nav-link">[9.10.0] - 2020-07-23</a>
|
||||||
|
<ul class="nav flex-column">
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="nav-item" data-level="2"><a href="#993-2020-07-17" class="nav-link">[9.9.3] - 2020-07-17</a>
|
<li class="nav-item" data-level="2"><a href="#993-2020-07-17" class="nav-link">[9.9.3] - 2020-07-17</a>
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
</ul>
|
</ul>
|
||||||
@ -852,6 +856,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="9100-2020-07-23">[9.10.0] - 2020-07-23</h2>
|
||||||
|
<p>(websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did</p>
|
||||||
<h2 id="993-2020-07-17">[9.9.3] - 2020-07-17</h2>
|
<h2 id="993-2020-07-17">[9.9.3] - 2020-07-17</h2>
|
||||||
<p>(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)</p>
|
<p>(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)</p>
|
||||||
<h2 id="992-2020-07-10">[9.9.2] - 2020-07-10</h2>
|
<h2 id="992-2020-07-10">[9.9.2] - 2020-07-10</h2>
|
||||||
|
@ -262,5 +262,5 @@ webSocket.send("hello world");
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
MkDocs version : 1.1.2
|
MkDocs version : 1.1.2
|
||||||
Build Date UTC : 2020-07-17 18:59:10.766805+00:00
|
Build Date UTC : 2020-07-24 02:30:29.533927+00:00
|
||||||
-->
|
-->
|
||||||
|
File diff suppressed because one or more lines are too long
16
sitemap.xml
16
sitemap.xml
@ -1,35 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url><url>
|
</url><url>
|
||||||
<loc>None</loc>
|
<loc>None</loc>
|
||||||
<lastmod>2020-07-17</lastmod>
|
<lastmod>2020-07-24</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
</urlset>
|
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
@ -330,6 +330,7 @@ uint32_t m = webSocket.getMaxWaitBetweenReconnectionRetries();
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<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>
|
||||||
<pre><code class="cpp">#include <ixwebsocket/IXWebSocketServer.h>
|
<pre><code class="cpp">#include <ixwebsocket/IXWebSocketServer.h>
|
||||||
|
|
||||||
...
|
...
|
||||||
@ -395,6 +396,70 @@ server.wait();
|
|||||||
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
|
<h3 id="new-api">New api</h3>
|
||||||
|
<p>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<WebSocket> down to the callbacks.</p>
|
||||||
|
<p>The webSocket reference is guaranteed to be always valid ; by design the callback will never be invoked with a null webSocket object.</p>
|
||||||
|
<pre><code class="cpp">#include <ixwebsocket/IXWebSocketServer.h>
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// Run a server on localhost at a given port.
|
||||||
|
// Bound host name, max connections and listen backlog can also be passed in as parameters.
|
||||||
|
ix::WebSocketServer server(port);
|
||||||
|
|
||||||
|
server.setOnClientMessageCallback(std::shared_ptr<ConnectionState> connectionState,
|
||||||
|
ConnectionInfo& connectionInfo,
|
||||||
|
WebSocket& webSocket,
|
||||||
|
const WebSocketMessagePtr& msg)
|
||||||
|
{
|
||||||
|
// The ConnectionInfo object contains information about the connection,
|
||||||
|
// at this point only the client ip address and the port.
|
||||||
|
std::cout << "Remote ip: " << connectionInfo.remoteIp << 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 << 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.
|
||||||
|
webSocket.send(msg->str, msg->binary);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
auto res = server.listen();
|
||||||
|
if (!res.first)
|
||||||
|
{
|
||||||
|
// Error handling
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the server in the background. Server can be stoped by calling server.stop()
|
||||||
|
server.start();
|
||||||
|
|
||||||
|
// Block until server.stop() is called.
|
||||||
|
server.wait();
|
||||||
|
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
<h2 id="http-client-api">HTTP client API</h2>
|
<h2 id="http-client-api">HTTP client API</h2>
|
||||||
<pre><code class="cpp">#include <ixwebsocket/IXHttpClient.h>
|
<pre><code class="cpp">#include <ixwebsocket/IXHttpClient.h>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user