<html><head><style>body{font-family:Helvetica,Arial;font-size:18px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:18px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Thanks so much for sending this - it held the key to unlocking the mystery. The problem was that I was including the protocol in the address string (i.e. I was using “<a href="ws://localhost">ws://localhost</a>” as opposed to “localhost”). None of the examples I saw included samples of the address but yours had a default value without the protocol which made the issue clear.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:18px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:18px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Thanks,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:18px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Mattia</div><p class="airmail_on" style="color:#000;">On May 20, 2015 at 9:26:12 AM, Brice Hamon (<a href="mailto:andy.green@linaro.org">andy.green@l</a><a href="mailto:andy.green@linaro.org">inaro.org</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>



<title></title>


<div dir="ltr">
<div class="gmail_default" style="font-size:x-small">Look at this
little client program. It may help you. </div>
<div class="gmail_default" style="font-size:x-small"><br></div>
<div class="gmail_default" style="font-size:x-small">Not pretty but
it works for me on windoz and Linux.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, May 20, 2015 at 9:03 AM, Mattia
Romeo <span dir="ltr"><<a href="mailto:andy.green@linaro.org" target="_blank">andy.green@linaro.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
I'm trying to create a C++ websocket client using libwebsockets but
I can't establish a connection due to it timing out (I think -
there may be other problems). I've stripped things down for testing
and here's what I'm using to establish a connection:</p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">Protocols</strong></p>
<pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)">
<code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">static</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">int</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> defaultCallback</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">struct</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  libwebsocket_context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">*</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">struct</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  libwebsocket</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">*</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> wsi</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">enum</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">    libwebsocket_callback_reasons reason</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">void</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">*</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">   user</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">void</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">*</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">   </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">in</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">size_t</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  len</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">)</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">{</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">return</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">}</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">

</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">static</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">struct</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_protocols protocols</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">[]</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">{</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">{</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">"default"</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> defaultCallback</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">},</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">{</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> NULL</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> NULL</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">}</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">};</span></code>
</pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">Create
Context</strong></p>
<pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)">
<code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">    </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">struct</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> lws_context_creation_info info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    memset</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(&</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">sizeof</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">));</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">port </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> CONTEXT_PORT_NO_LISTEN</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">#ifndef</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> LWS_NO_EXTENSIONS
    info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">extensions </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_get_internal_extensions</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">();</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">#endif</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">gid </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">-</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">uid </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">-</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">protocols </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> protocols</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">

    _context </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_create_context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(&</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">info</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">);</span></code>
</pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">Create
Client</strong></p>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">NOTE</strong>:
The address "<a>ws://localhost</a>" I've also tried
"<a>ws://echo.websocket.org</a>". The localhost server is a Node
& ws app that I've tested with Chrome and works perfectly.</p>
<pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)">
<code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">_websocket </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_client_connect</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">_context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         _address</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">c_str</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(),</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// address</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         _port</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// port</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// use ssl?</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">"/"</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// path</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         _address</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">c_str</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(),</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// host</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         NULL</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// origin</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         NULL</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// protocol</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
                                         </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">-</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">);</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">   </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">// version</span></code>
</pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">Service The
Context</strong></p>
<pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)">
<code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">while</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">)</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">{</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
    libwebsocket_service</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">_context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">50</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">);</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">}</span></code>
</pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
<strong style="margin:0px;padding:0px;border:0px">Output</strong> When I run
the above this is the output I get through the libwebsockets
logging callback:</p>
<pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;color:rgb(57,51,24);word-wrap:normal;background-color:rgb(238,238,238)">
<code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Initial</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> logging level </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1023</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Library</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> version</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1.4</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">3ae1bad</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> IPV6 </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">not</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> compiled </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">in</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libev support </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">not</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> compiled </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">in</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  LWS_MAX_HEADER_LEN</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1024</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  LWS_MAX_PROTOCOLS</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">5</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  SPEC_LATEST_SUPPORTED</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">13</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  AWAITING_TIMEOUT</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">5</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  SYSTEM_RANDOM_FILEPATH</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">'/dev/urandom'</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  LWS_MAX_ZLIB_CONN_BUFFER</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">65536</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">static</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> allocation</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">4536</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">+</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">(</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">16</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> x </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">10240</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> fds</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">)</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">168376</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> bytes
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  LWS_MAX_EXTENSIONS_ACTIVE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">3</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  canonical_hostname </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> an</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">-</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">iMac
NOTICE</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">  per</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">-</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">conn mem</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">248</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">+</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">2140</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> headers </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">+</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> protocol rx buf
PARSER</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">   </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Protocol</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">default</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
CLIENT</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_client_connect</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> direct conn
CLIENT</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_client_connect_2
CLIENT</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> libwebsocket_client_connect_2</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> address ws</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,128,128)">//localhost</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> insert_wsi_socket_into_fds</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> wsi</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0x7ff808514c70</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> sock</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">8</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> fds pos</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
CLIENT</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> nonblocking connect </span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,139)">retry</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> TIMEDOUT WAITING on </span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">2</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
DEBUG</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> close</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> just_kill_connection
INFO</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> remove_wsi_socket_from_fds</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> wsi</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">0x7ff808514c70</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> sock</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">8</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">,</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> fds pos</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(128,0,0)">1</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">
DEBUG</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)">:</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">Connection</span><span style="margin:0px;padding:0px;border:0px;color:rgb(0,0,0)"> closed before server reply</span></code>
</pre>
<p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,34,34);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,255,255)">
I've looked at all the libwebsockets examples/documentation I can
get my hands on and can't get any info on how to resolve this. Any
help would be greatly appreciated and prevent me from putting my
head through my monitor.</p>
<div><br></div>
<div>Thanks,</div>
<div>Mattia</div>
</div>
<br>
_______________________________________________<br>
Libwebsockets mailing list<br>
<a href="mailto:Libwebsockets@ml.libwebsockets.org">Libwebsockets@ml.libwebsockets.org</a><br>

<a href="http://ml.libwebsockets.org/mailman/listinfo/libwebsockets" target="_blank">http://ml.libwebsockets.org/mailman/listinfo/libwebsockets</a><br>

<br></blockquote>
</div>
<br></div>


<hr>_______________________________________________
<br>Libwebsockets mailing list
<br>Libwebsockets@ml.libwebsockets.org
<br>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
<br></div></div></span></blockquote></body></html>