Security WSS from node example, MQTTS via mosquito_pub
These were really hard to google out (and in fact not found) and we never found real example for mosquito_pub/sub so it was simple trial-and-error method... worth publishing short post..
MQTTs
xinput test 12 | \
stdbuf -o0 grep release | \
stdbuf -o0 awk '{print "{\"e\":[{\"n\":\"key\",\"v\":1}]}"}' | \
stdbuf -o0 mosquitto_pub -u 'thingID' \
-P 'thingToken' -t 'thingPublishChannel' \
-l -d \ # read from stdin, and debug
-p 8883 -h mqtt.rapifire.com \
--cafile ~/Projects/keys-and-certificates/startssl_com.sub.class1.server.ca.pem \
--capath /etc/ssl/certs/ \
--tls-version tlsv1.1
Websockets Security (WSS)
var WebSocket = require('ws');
require('ssl-root-cas/latest').inject().addFile(__dirname + '/startssl_com.sub.class1.server.ca.pem');