Install/Mosquitto Mqtt Broker: Difference between revisions
Jump to navigation
Jump to search
(Created page with "See http://mosquitto.org * [http://stackoverflow.com/questions/26657319/how-do-you-set-up-encrypted-mosquitto-broker-like-a-webpage-which-has-https#answer-34333973 secure webs...") |
No edit summary |
||
| Line 1: | Line 1: | ||
See http://mosquitto.org | See http://mosquitto.org | ||
== Enable Websocket == | |||
See [http://stackoverflow.com/questions/26657319/how-do-you-set-up-encrypted-mosquitto-broker-like-a-webpage-which-has-https#answer-34333973 secure websocket] | |||
nano /etc/mosquitto/conf.d/ws.conf | |||
For secure websocket (wss) add this: | |||
listener 9001 | |||
protocol websockets | |||
certfile /etc/letsencrypt/live/playfulexploration.com/cert.pem | |||
cafile /etc/letsencrypt/live/playfulexploration.com/chain.pem | |||
keyfile /etc/letsencrypt/live/playfulexploration.com/privkey.pem | |||
Alternatively for unsecure websocket (ws) omit the cert- and keyfiles: | |||
listener 9001 | |||
protocol websockets | |||
Restart the broker service: | |||
service mosquitto stop | |||
service mosquitto start | |||
tail /var/log/mosquitto/mosquitto.log # ensure no errors | |||
On the wappage's javascript use this to connect: | |||
wss://playfulexploration.com:9001 | |||
or | |||
ws://playfulexploration.com:9001 | |||
Revision as of 02:59, 24 May 2016
Enable Websocket
See secure websocket
nano /etc/mosquitto/conf.d/ws.conf
For secure websocket (wss) add this:
listener 9001 protocol websockets certfile /etc/letsencrypt/live/playfulexploration.com/cert.pem cafile /etc/letsencrypt/live/playfulexploration.com/chain.pem keyfile /etc/letsencrypt/live/playfulexploration.com/privkey.pem
Alternatively for unsecure websocket (ws) omit the cert- and keyfiles:
listener 9001 protocol websockets
Restart the broker service:
service mosquitto stop service mosquitto start tail /var/log/mosquitto/mosquitto.log # ensure no errors
On the wappage's javascript use this to connect:
wss://playfulexploration.com:9001
or
ws://playfulexploration.com:9001