README.md
1# lws minimal ws client
2
3This connects to libwebsockets.org using the dumb-increment-protocol.
4
5It demonstrates how to use the connection retry and backoff stuff in lws.
6
7## build
8
9```
10 $ cmake . && make
11```
12
13## Commandline Options
14
15Option|Meaning
16---|---
17-d|Set logging verbosity
18-s|Use a specific server instead of libwebsockets.org, eg `--server localhost`. Implies LCCSCF_ALLOW_SELFSIGNED
19-p|Use a specific port instead of 443, eg `--port 7681`
20-j|Allow selfsigned tls cert
21-k|Allow insecure certs
22-m|Skip server hostname check
23-e|Allow expired certs
24--protocol|Use a specific ws subprotocol rather than dumb-increment-protocol, eg, `--protocol myprotocol`
25
26
27## usage
28
29Just run it, it will connect to libwebsockets.org and spew incrementing numbers
30sent by the server at 20Hz
31
32```
33 $ ./lws-minimal-ws-client
34[2020/01/22 05:38:47:3409] U: LWS minimal ws client
35[2020/01/22 05:38:47:4456] N: Loading client CA for verification ./libwebsockets.org.cer
36[2020/01/22 05:38:48:1649] U: callback_minimal: established
37[2020/01/22 05:38:48:1739] N:
38[2020/01/22 05:38:48:1763] N: 0000: 30 0
39[2020/01/22 05:38:48:1765] N:
40
41...
42```
43
44To test against the lws test server instead of libwebsockets.org, run the test
45server as
46
47```
48$ libwebsockets-test-server -s
49```
50
51and run this test app with
52
53```
54$ ./lws-minimal-ws-client -s localhost -p 7681 -j
55```
56
57You can kill and restart the server to confirm the client connection is re-
58established if done within the backoff period.
59