[Libwebsockets] Standard ws SSL and compression enabled client

Michael Behrns-Miller moodboom at gmail.com
Fri Jun 17 22:16:48 CEST 2016


Thanks Andy that was quick and thorough, wow.

Here's the run line I was using, I didn't include it before sorry.
I'm using my local LAN IP, with the server running on the same box and
responding to other clients:

   lws_test_client wss://192.168.202.120 --port=8090 --ssl -s -d65535

Here's output at that debug level:

[2016/06/17 16:09:20:6704] NOTICE: libwebsockets test client - license
LGPL2.1+SLE
[2016/06/17 16:09:20:6705] NOTICE: (C) Copyright 2010-2016 Andy Green <
andy at warmcat.com>
[2016/06/17 16:09:25:4725] NOTICE:  Selfsigned certs allowed
[2016/06/17 16:09:25:4725] NOTICE: Initial logging level 65535
[2016/06/17 16:09:25:4725] NOTICE: Libwebsockets version: 2.0.0
m at wallee-v2.0.0-88-g5fa1b7a
[2016/06/17 16:09:25:4725] NOTICE: IPV6 not compiled in
[2016/06/17 16:09:25:4725] NOTICE: libev support not compiled in
[2016/06/17 16:09:25:4725] NOTICE: libuv support not compiled in
[2016/06/17 16:09:25:4725] INFO:  LWS_DEF_HEADER_LEN    : 1024
[2016/06/17 16:09:25:4725] INFO:  LWS_MAX_PROTOCOLS     : 5
[2016/06/17 16:09:25:4725] INFO:  LWS_MAX_SMP           : 32
[2016/06/17 16:09:25:4726] INFO:  SPEC_LATEST_SUPPORTED : 13
[2016/06/17 16:09:25:4726] INFO:  sizeof (*info)        : 304
[2016/06/17 16:09:25:4726] INFO:  SYSTEM_RANDOM_FILEPATH: '/dev/urandom'
[2016/06/17 16:09:25:4726] INFO:  default timeout (secs): 20
[2016/06/17 16:09:25:4726] NOTICE:  Threads: 1 each 1024 fds
[2016/06/17 16:09:25:4726] INFO:  mem: context:          9520 bytes (5424
ctx + (1 thr x 4096))
[2016/06/17 16:09:25:4727] INFO:  mem: http hdr rsvd:   73728 bytes (1 thr
x (1024 + 3584) x 16))
[2016/06/17 16:09:25:4727] INFO:  mem: pollfd map:       8192
[2016/06/17 16:09:25:4727] NOTICE:  mem: platform fd map:  8192 bytes
[2016/06/17 16:09:25:4727] NOTICE:  Compiled with OpenSSL support
[2016/06/17 16:09:25:4741] NOTICE: Creating Vhost 'default' port -1, 2
protocols, IPv6 off
[2016/06/17 16:09:25:4743] INFO:  SSL options 0x3520004
[2016/06/17 16:09:25:4744] INFO:  LWS_MAX_EXTENSIONS_ACTIVE: 2
[2016/06/17 16:09:25:4744] NOTICE:  mem: per-conn:          496 bytes +
protocol rx buf
[2016/06/17 16:09:25:4744] NOTICE:  canonical_hostname = wallee
[2016/06/17 16:09:25:4744] NOTICE: using wss mode (ws)
[2016/06/17 16:09:25:4744] NOTICE: dumb: connecting
[2016/06/17 16:09:25:4744] DEBUG: lws_union_transition: 0x1c52ad0: mode 1
[2016/06/17 16:09:25:4744] INFO: lws_header_table_attach: wsi 0x1c52ad0: ah
(nil) (tsi 0)
[2016/06/17 16:09:25:4744] INFO: lws_header_table_attach: wsi 0x1c52ad0: ah
0x1c200a0: count 1 (on exit)
[2016/06/17 16:09:25:4745] CLIENT: lws_client_connect: direct conn
[2016/06/17 16:09:25:4745] CLIENT: lws_client_connect_2
[2016/06/17 16:09:25:4745] CLIENT: lws_client_connect_2: address
192.168.202.120
[2016/06/17 16:09:25:4745] DEBUG: insert_wsi_socket_into_fds: 0x1c52ad0:
tsi=0, sock=6, pos-in-fds=1
[2016/06/17 16:09:25:4745] DEBUG: lws_set_timeout: 0x1c52ad0: 20 secs
[2016/06/17 16:09:25:4746] CLIENT: nonblocking connect retry
[2016/06/17 16:09:25:4746] NOTICE: mirror: connecting
[2016/06/17 16:09:25:4746] DEBUG: lws_union_transition: 0x1c52cd0: mode 1
[2016/06/17 16:09:25:4746] INFO: lws_header_table_attach: wsi 0x1c52cd0: ah
(nil) (tsi 0)
[2016/06/17 16:09:25:4746] INFO: lws_header_table_attach: wsi 0x1c52cd0: ah
0x1c20ea0: count 2 (on exit)
[2016/06/17 16:09:25:4746] CLIENT: lws_client_connect: direct conn
[2016/06/17 16:09:25:4747] CLIENT: lws_client_connect_2
[2016/06/17 16:09:25:4747] CLIENT: lws_client_connect_2: address
192.168.202.120
[2016/06/17 16:09:25:4747] DEBUG: insert_wsi_socket_into_fds: 0x1c52cd0:
tsi=0, sock=7, pos-in-fds=2
[2016/06/17 16:09:25:4747] DEBUG: lws_set_timeout: 0x1c52cd0: 20 secs
[2016/06/17 16:09:25:4747] CLIENT: nonblocking connect retry
[2016/06/17 16:09:25:4747] NOTICE: lws_protocol_init
[2016/06/17 16:09:25:4747] DEBUG: fd=6, revents=29
[2016/06/17 16:09:25:4747] CLIENT: lws_client_connect_2
[2016/06/17 16:09:25:4748] CLIENT: lws_client_connect_2: address
192.168.202.120
[2016/06/17 16:09:25:4748] DEBUG: Connect failed errno=111
[2016/06/17 16:09:25:4748] INFO: lws_close_free_wsi: real
just_kill_connection: 0x1c52ad0 (sockfd 6)
[2016/06/17 16:09:25:4748] INFO: remove_wsi_socket_from_fds: removing same
prot wsi 0x1c52ad0
[2016/06/17 16:09:25:4748] INFO: remove_wsi_socket_from_fds: wsi=0x1c52ad0,
sock=6, fds pos=1, end guy pos=3, endfd=0
[2016/06/17 16:09:25:4748] DEBUG: Connection closed before server reply
[2016/06/17 16:09:25:4748] ERR: dumb: LWS_CALLBACK_CLIENT_CONNECTION_ERROR
[2016/06/17 16:09:25:4748] INFO: lws_header_table_detach: wsi 0x1c52ad0: ah
0x1c200a0 (tsi=0, count = 2)
[2016/06/17 16:09:25:4748] DEBUG: lws_free_wsi: 0x1c52ad0, remaining wsi 1
[2016/06/17 16:09:25:4749] CLIENT: closed
[2016/06/17 16:09:25:4749] DEBUG: fd=7, revents=29
[2016/06/17 16:09:25:4749] CLIENT: lws_client_connect_2
[2016/06/17 16:09:25:4749] CLIENT: lws_client_connect_2: address
192.168.202.120
[2016/06/17 16:09:25:4749] DEBUG: Connect failed errno=111
[2016/06/17 16:09:25:4749] INFO: lws_close_free_wsi: real
just_kill_connection: 0x1c52cd0 (sockfd 7)
[2016/06/17 16:09:25:4749] INFO: remove_wsi_socket_from_fds: removing same
prot wsi 0x1c52cd0
[2016/06/17 16:09:25:4749] INFO: remove_wsi_socket_from_fds: wsi=0x1c52cd0,
sock=7, fds pos=1, end guy pos=2, endfd=7
[2016/06/17 16:09:25:4749] DEBUG: Connection closed before server reply
[2016/06/17 16:09:25:4749] ERR: mirror: LWS_CALLBACK_CLIENT_CONNECTION_ERROR
[2016/06/17 16:09:25:4749] INFO: lws_header_table_detach: wsi 0x1c52cd0: ah
0x1c20ea0 (tsi=0, count = 1)
[2016/06/17 16:09:25:4750] DEBUG: lws_free_wsi: 0x1c52cd0, remaining wsi 0
[2016/06/17 16:09:25:4750] CLIENT: closed


On Fri, Jun 17, 2016 at 4:00 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> 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:
> >
> >   cmake -static -DLWS_WITHOUT_TESTAPPS=1 -DLWS_WITH_SSL=1
> >-DLWS_WITH_ZLIB=1 -DLWS_WITHOUT_EXTENSIONS=0 ..
> >
> >The client starts right up, but gives me
> >LWS_CALLBACK_CLIENT_CONNECTION_ERROR.
> >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
> >off
> >yet.
>
> Tell cmake to build in debug mode
>
> $ cmake .. -DCMAKE_BUILD_TYPE=DEBUG
>
> 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...
>
> -Andy
>
> >Thanks,
> >Michael
> >
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >Libwebsockets mailing list
> >Libwebsockets at ml.libwebsockets.org
> >http://libwebsockets.org/mailman/listinfo/libwebsockets
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160617/a1b87787/attachment-0001.html>


More information about the Libwebsockets mailing list