1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/ws-client/minimal-ws-client-rx
Andy Green 8829c2f365 selftests
This converts several of the selftests to return a status in their exit code
about whether they 'worked'.

A small bash script framework is added, with a selftest.sh in the mininmal
example dirs that support it, and a ./minimal-examples/selftests.sh script
that can be run from the build dir with no args that discovers and runs all
the selftest.sh scripts underneath.

That is also integrated into travis and the enabled tests must pass now for
travis to pass.  Travis does not have a modern libuv so it can't run a
couple of tests which are nulled out if it sees it's running in travis env.
2018-04-19 16:16:48 +08:00
..
CMakeLists.txt minimal: http-server-tls 2018-04-06 10:38:03 +08:00
libwebsockets.org.cer mbedtls: wrapper: client: Force mbedTLS to attemp to verify cert 2018-04-06 10:38:03 +08:00
minimal-ws-client.c selftests 2018-04-19 16:16:48 +08:00
README.md minimal: ws-client-tx and change dir names to match project name 2018-04-06 10:38:03 +08:00
selftest.sh selftests 2018-04-19 16:16:48 +08:00

lws minimal ws client rx

build

 $ cmake . && make

usage

The application goes to https://libwebsockets.org and makes a wss connection using the dumb-increment-protocol. It shows the incrementing number it is being sent over ws as it arrives.

This example only receives things to keep it simple. See minimal-ws-client-tx for code related to sending things. Of course rx and tx are supported in the same protocol.

./lws-minimal-ws-client-rx
[2018/03/14 11:57:24:0689] USER: LWS minimal ws client rx
[2018/03/14 11:57:24:0705] NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 off
[2018/03/14 11:57:24:0710] NOTICE: created client ssl context for default
[2018/03/14 11:57:24:0788] NOTICE: lws_client_connect_2: 0x15b8310: address libwebsockets.org
[2018/03/14 11:57:24:7643] NOTICE: lws_client_connect_2: 0x15b8310: address libwebsockets.org
[2018/03/14 11:57:26:9191] USER: RX: 0
[2018/03/14 11:57:26:9318] USER: RX: 1
[2018/03/14 11:57:27:2182] USER: RX: 2
[2018/03/14 11:57:27:2336] USER: RX: 3
[2018/03/14 11:57:27:2838] USER: RX: 4
[2018/03/14 11:57:27:5173] USER: RX: 5
[2018/03/14 11:57:27:5352] USER: RX: 6
[2018/03/14 11:57:27:5854] USER: RX: 7
[2018/03/14 11:57:27:8156] USER: RX: 8
[2018/03/14 11:57:27:8359] USER: RX: 9
^C[2018/03/14 11:57:27:9884] USER: Completed