• Home
Name Date Size #Lines LOC

..--

CMakeLists.txtD12-May-2024671 2419

README.mdD12-May-20241.2 KiB5236

minimal-mqtt-client.cD12-May-20248.8 KiB357251

mosq-ca.crtD12-May-20241.3 KiB2322

mosq-server.crtD12-May-20241.1 KiB2120

mosq-server.keyD12-May-20241.6 KiB2827

README.md

1# lws minimal MQTT client
2
3The application connects to a broker at localhost 1883 (unencrypted) or
48883 (tls)
5
6## build
7
8```
9 $ cmake . && make
10```
11
12## usage
13
14Commandline option|Meaning
15---|---
16-d <loglevel>|Debug verbosity in decimal, eg, -d15
17-s| Use tls and connect to port 8883 instead of 1883
18
19Start mosquitto server locally
20
21```
22$ mosquitto
23```
24
25Run the example
26
27```
28[2020/01/31 10:40:23:7789] U: LWS minimal MQTT client unencrypted [-d<verbosity>][-s]
29[2020/01/31 10:40:23:8539] N: lws_mqtt_generate_id: User space provided a client ID 'lwsMqttClient'
30[2020/01/31 10:40:23:9893] N: _lws_mqtt_rx_parser: migrated nwsi 0x50febd0 to sid 1 0x5106820
31[2020/01/31 10:40:23:9899] U: callback_mqtt: MQTT_CLIENT_ESTABLISHED
32[2020/01/31 10:40:23:9967] U: callback_mqtt: WRITEABLE: Subscribing
33[2020/01/31 10:40:24:0068] U: callback_mqtt: MQTT_SUBSCRIBED
34```
35
36Send something to the test client
37
38
39```
40mosquitto_pub -h 127.0.0.1 -p 1883 -t test/topic0 -m "hello"
41```
42
43Observe it received at the test client
44
45```
46[2020/01/31 10:40:27:1845] U: callback_mqtt: MQTT_CLIENT_RX
47[2020/01/31 10:40:27:1870] N:
48[2020/01/31 10:40:27:1945] N: 0000: 74 65 73 74 2F 74 6F 70 69 63 30                   test/topic0
49[2020/01/31 10:40:27:1952] N:
50
51```
52