File: README.md

package info (click to toggle)
libwebsockets 4.3.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 31,288 kB
  • sloc: ansic: 194,407; javascript: 1,550; sh: 1,387; cpp: 505; java: 461; perl: 405; xml: 118; makefile: 76; awk: 5
file content (59 lines) | stat: -rw-r--r-- 1,548 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# lws minimal ws client

This connects to libwebsockets.org using the dumb-increment-protocol.

It demonstrates how to use the connection retry and backoff stuff in lws.

## build

```
 $ cmake . && make
```

## Commandline Options

Option|Meaning
---|---
-d|Set logging verbosity
-s|Use a specific server instead of libwebsockets.org, eg `--server localhost`.  Implies LCCSCF_ALLOW_SELFSIGNED
-p|Use a specific port instead of 443, eg `--port 7681`
-j|Allow selfsigned tls cert
-k|Allow insecure certs
-m|Skip server hostname check
-n|Skip tls usage
-e|Allow expired certs
--protocol|Use a specific ws subprotocol rather than dumb-increment-protocol, eg, `--protocol myprotocol`


## usage

Just run it, it will connect to libwebsockets.org and spew incrementing numbers
sent by the server at 20Hz

```
 $ ./lws-minimal-ws-client
[2020/01/22 05:38:47:3409] U: LWS minimal ws client
[2020/01/22 05:38:47:4456] N: Loading client CA for verification ./libwebsockets.org.cer
[2020/01/22 05:38:48:1649] U: callback_minimal: established
[2020/01/22 05:38:48:1739] N: 
[2020/01/22 05:38:48:1763] N: 0000: 30                                                 0               
[2020/01/22 05:38:48:1765] N: 

...
```

To test against the lws test server instead of libwebsockets.org, run the test
server as

```
$ libwebsockets-test-server -s
```

and run this test app with

```
$ ./lws-minimal-ws-client -s localhost -p 7681 -j
```

You can kill and restart the server to confirm the client connection is re-
established if done within the backoff period.