Deployed fbd1768 with MkDocs version: 1.1.2

This commit is contained in:
2020-07-08 19:14:25 +00:00
parent ddf992a03c
commit 3d4ecc4501
6 changed files with 30 additions and 18 deletions

View File

@ -95,6 +95,10 @@
<li class="nav-item" data-level="1"><a href="#changelog" class="nav-link">Changelog</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#990-2020-07-08" class="nav-link">[9.9.0] - 2020-07-08</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#986-2020-07-06" class="nav-link">[9.8.6] - 2020-07-06</a>
<ul class="nav flex-column">
</ul>
@ -836,6 +840,8 @@
<h1 id="changelog">Changelog</h1>
<p>All changes to this project will be documented in this file.</p>
<h2 id="990-2020-07-08">[9.9.0] - 2020-07-08</h2>
<p>(socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made</p>
<h2 id="986-2020-07-06">[9.8.6] - 2020-07-06</h2>
<p>(cmake) change the way zlib and openssl are searched</p>
<h2 id="985-2020-07-06">[9.8.5] - 2020-07-06</h2>

View File

@ -262,5 +262,5 @@ webSocket.send(&quot;hello world&quot;);
<!--
MkDocs version : 1.1.2
Build Date UTC : 2020-07-07 17:59:20.821904+00:00
Build Date UTC : 2020-07-08 19:14:25.100453+00:00
-->

File diff suppressed because one or more lines are too long

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-07-07</lastmod>
<lastmod>2020-07-08</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

View File

@ -340,28 +340,31 @@ ix::WebSocketServer server(port);
server.setOnConnectionCallback(
[&amp;server](std::shared_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::cout &lt;&lt; &quot;Remote ip: &quot; &lt;&lt; connectionInfo-&gt;remoteIp &lt;&lt; std::endl;
webSocket-&gt;setOnMessageCallback(
[webSocket, connectionState, &amp;server](const ix::WebSocketMessagePtr msg)
{
if (msg-&gt;type == ix::WebSocketMessageType::Open)
{
std::cerr &lt;&lt; &quot;New connection&quot; &lt;&lt; std::endl;
std::cout &lt;&lt; &quot;New connection&quot; &lt;&lt; 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::cerr &lt;&lt; &quot;id: &quot; &lt;&lt; connectionState-&gt;getId() &lt;&lt; std::endl;
std::cout &lt;&lt; &quot;id: &quot; &lt;&lt; connectionState-&gt;getId() &lt;&lt; std::endl;
// The uri the client did connect to.
std::cerr &lt;&lt; &quot;Uri: &quot; &lt;&lt; msg-&gt;openInfo.uri &lt;&lt; std::endl;
std::cout &lt;&lt; &quot;Uri: &quot; &lt;&lt; msg-&gt;openInfo.uri &lt;&lt; std::endl;
std::cerr &lt;&lt; &quot;Headers:&quot; &lt;&lt; std::endl;
std::cout &lt;&lt; &quot;Headers:&quot; &lt;&lt; std::endl;
for (auto it : msg-&gt;openInfo.headers)
{
std::cerr &lt;&lt; it.first &lt;&lt; &quot;: &quot; &lt;&lt; it.second &lt;&lt; std::endl;
std::cout &lt;&lt; it.first &lt;&lt; &quot;: &quot; &lt;&lt; it.second &lt;&lt; std::endl;
}
}
else if (msg-&gt;type == ix::WebSocketMessageType::Message)
@ -493,11 +496,14 @@ server.wait();
<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 class="cpp">setOnConnectionCallback(
[this](HttpRequestPtr request,
std::shared_ptr&lt;ConnectionState&gt; /*connectionState*/) -&gt; HttpResponsePtr
std::shared_ptr&lt;ConnectionState&gt; /*connectionState*/,
std::unique_ptr&lt;ConnectionInfo&gt; connectionInfo) -&gt; HttpResponsePtr
{
// Build a string for the response
std::stringstream ss;
ss &lt;&lt; request-&gt;method
ss &lt;&lt; connectionInfo-&gt;remoteIp
&lt;&lt; &quot; &quot;
&lt;&lt; request-&gt;method
&lt;&lt; &quot; &quot;
&lt;&lt; request-&gt;uri;