[Libwebsockets] lwsws

Vitaly Shevtsov shev.vt1984 at gmail.com
Fri Nov 30 11:31:23 CET 2018


Good day! I use vanila lwsws and try to implement simple plugin. In plugin
I use lws_client_connect_via_info to connect to another WS-server. On the
server side I see my connection but I can't see
LWS_CALLBACK_CLIENT_ESTABLISHED callback in plugin. What may be wrong?

Forgot to mention: If I use this plugin standalone, client connection works
as expected.

Thanks!


On November 29, 2018 10:22:47 PM GMT+08:00, Vitaly Shevtsov <
shev.vt1984 at gmail.com
<https://e.mail.ru/compose/?mailto=mailto%3ashev.vt1984@gmail.com>> wrote:
>Good day! I use vanila lwsws and try to implement simple plugin. In
>plugin
>I use lws_client_connect_via_info to connect to another WS-server. On
>the
>server side I see my connection but I can't see
>LWS_CALLBACK_CLIENT_ESTABLISHED callback in plugin. What may be wrong?

You need "enable-client-ssl": "1" on the config for the vhost you created
the client on, if the destination is wss.

You also need to list your protocol under "ws-protocols" for the vhost conf.

Notice the client connect info struct allows you to bind the new connection
to a specific local protocol name.

https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-client.h#n108-114

But nost of all you need to enable logging with eg, -d1039 and confirm your
plugin loaded and the protocol is there.  And look at the logging to see
what it says about the client connect.

If you want to follow up please use the mailing list.

-Andy

>Thanks!


Thanks for your reply. Unfortunately this didn't help, all you wrote have
been done before and works well when there is no client connection inside
the plugin.

I found the way to reproduce this issue - I attached modified
protocol_dumb_increment.c to show what I mean. Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20181130/2783c9e2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: protocol_dumb_increment.c
Type: text/x-csrc
Size: 5335 bytes
Desc: not available
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20181130/2783c9e2/attachment.bin>


More information about the Libwebsockets mailing list