This image contains mqtt server and websocket built with nodejs
79
docker build -t kuduiso/combined-mqtt-ws-server:latest .
docker run -d --name combined-server -p 8080:8080 -p 1883:1883 -p 8883:8883 -e MQTT_USERNAME=<USERNAME> -e MQTT_PASSWORD=<STRONG_PASSWORD> kuduiso/combined-mqtt-ws-server:latest
docker push kuduiso/combined-mqtt-ws-server:latest
npx wscat -c ws://localhost:8080
npm install -g mqtt
mqtt sub -t 'test/topic' -h localhost -p 1883
mqtt sub -t 'test/topic' -h localhost -p 1883 -u <USERNAME> --password <PASSWORD>
mqtt pub -t 'test/topic' -m 'hello' -h localhost -p 1883
mqtt pub -t 'test/topic' -m 'hello' -h localhost -p 1883 -u <USERNAME> --password <PASSWORD>
Subscribe (terminal 1)
mqtt sub -t 'test/topic' --url ws://localhost:8883
mqtt sub -h <hostname> -p 443 -l wss --insecure -t 'test/topic'
Publish (terminal 2)
mqtt pub -t 'test/topic' -m 'hello over ws' --url ws://localhost:8883
mqtt pub -h <hostname> -p 443 -l wss --insecure -t 'test/topic' -m 'Hello from MQTT'
docker logs -f <container-name-or-id>
curl -vk \ --http1.1 \ -H "Origin: null" \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" \ -H "Sec-WebSocket-Key: SGVsbG9XZWJTb2NrZXQ=" \ https://<HOSTNAME>/
Content type
Image
Digest
sha256:04a52dd31…
Size
58.3 MB
Last updated
about 1 month ago
docker pull kuduiso/combined-mqtt-ws-server