| 1 |
# lws minimal ws client tx |
| 2 |
|
| 3 |
This demonstrates a ws "publisher" to go with the minimal-ws-broker example. |
| 4 |
|
| 5 |
Two threads are spawned that produce messages to be sent to the broker, |
| 6 |
via a local ringbuffer. Locking is provided to make ringbuffer access threadsafe. |
| 7 |
|
| 8 |
When a nailed-up client connection to the broker is established, the |
| 9 |
ringbuffer is sent to the broker, which distributes the events to all |
| 10 |
connected clients. |
| 11 |
|
| 12 |
## build |
| 13 |
|
| 14 |
``` |
| 15 |
$ cmake . && make |
| 16 |
``` |
| 17 |
|
| 18 |
## usage |
| 19 |
|
| 20 |
This example connects to ws-server/minimal-ws-broker, so you need to build and run |
| 21 |
that in another terminal. |
| 22 |
|
| 23 |
``` |
| 24 |
$ ./lws-minimal-ws-client-tx |
| 25 |
[2018/03/16 16:04:33:5774] USER: LWS minimal ws client tx |
| 26 |
[2018/03/16 16:04:33:5774] USER: Run minimal-ws-broker and browse to that |
| 27 |
[2018/03/16 16:04:33:5774] NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 off |
| 28 |
[2018/03/16 16:04:34:5794] USER: callback_minimal_broker: established |
| 29 |
``` |
| 30 |
|
| 31 |
If you open a browser on http://localhost:7681 , you will see the subscribed |
| 32 |
messages from the threads in this app via the broker app. |
| 33 |
|