mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() Add support for external pthreads lib on windows and some docs about how to do. It can build with LWS_WITH_THREADPOOL and LWS_WITH_MINIMAL_EXAMPLES including the pthreads-dependent ones without warnings or errors on windows platform as well with this. pthreads_t can be anything, including a struct - not a pointer-to-a-struct but the struct itself. These can't be cast to a void * for printing as they can on linux, where the base type is a pointer. Let's fix all the usage of those to determine their own thread index in terms of the meaning to the program rather than as a tid. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
minimal-mqtt-client.c | ||
mosq-ca.crt | ||
mosq-server.crt | ||
mosq-server.key | ||
README.md |
lws minimal MQTT client
The application connects to a broker at localhost 1883 (unencrypted) or 8883 (tls)
build
$ cmake . && make
usage
Commandline option | Meaning |
---|---|
-d | Debug verbosity in decimal, eg, -d15 |
-s | Use tls and connect to port 8883 instead of 1883 |
Start mosquitto server locally
$ mosquitto
Run the example
[2020/01/31 10:40:23:7789] U: LWS minimal MQTT client unencrypted [-d<verbosity>][-s]
[2020/01/31 10:40:23:8539] N: lws_mqtt_generate_id: User space provided a client ID 'lwsMqttClient'
[2020/01/31 10:40:23:9893] N: _lws_mqtt_rx_parser: migrated nwsi 0x50febd0 to sid 1 0x5106820
[2020/01/31 10:40:23:9899] U: callback_mqtt: MQTT_CLIENT_ESTABLISHED
[2020/01/31 10:40:23:9967] U: callback_mqtt: WRITEABLE: Subscribing
[2020/01/31 10:40:24:0068] U: callback_mqtt: MQTT_SUBSCRIBED
Send something to the test client
mosquitto_pub -h 127.0.0.1 -p 1883 -t test/topic0 -m "hello"
Observe it received at the test client
[2020/01/31 10:40:27:1845] U: callback_mqtt: MQTT_CLIENT_RX
[2020/01/31 10:40:27:1870] N:
[2020/01/31 10:40:27:1945] N: 0000: 74 65 73 74 2F 74 6F 70 69 63 30 test/topic0
[2020/01/31 10:40:27:1952] N: