[Libwebsockets] Standard ws SSL and compression enabled client

Andy Green andy at warmcat.com
Fri Jun 17 22:00:14 CEST 2016

On June 18, 2016 3:33:45 AM GMT+08:00, Michael Behrns-Miller <moodboom at gmail.com> wrote:
>Hello and thanks Andy for the library, appreciate it!
>I have not had any luck getting a client going using test-client.c.
>I have enabled SSL and zlib in my libwebsockets build via:
>The client starts right up, but gives me
>Wireshark shows no packets on the requested port, so I must be doing
>something wrong.

That narrows it down a lot.

>I've stepped through the process in the debugger but no bells have gone

Tell cmake to build in debug mode


and run it with -d65535 log level

>Is v2.0 of test-client.c ok to use for a simple standard ws client?

Yes, although it demonstrates using the ws protocols in our test server (and you should use v2.0-stable or the point releases like v2.0.2 to get bugfixes).

You can sanity-check our stock test client against our public server, open this in a browser

$ https://libwebsockets.org/testserver/

go to the 'mirror' tab, and run our test client

$ libwebsockets-test-client wss://libwebsockets.org

You should see a lot of circles spamming the shared canvas.

>If so any ideas on what I could be doing wrong?
>I've verified that the test server I'm using (a simple node ws server)
>works with other clients
>like websocket.org/echo.html.

If you're really not even getting on the network, the server isn't related to your problem.  Lws can interoperate with any rfc6455 compliant server.  But, eg, if your client asks for xyz ws protocol, the server will need to offer it or negotiation will fail, which should be clear from the logs.

It sounds more like wrong port, unable to resolve the dns name, firewall etc, the logging might give a clue.  It's hard to guess better without your changes to the code or what commandline you're testing with...


>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list