eclipse-paho / eclipse-paho/paho.mqtt.javascript
websockify support (websocket binary protocol)
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 466
- PR merge metrics
- No merged PRs in 30d
Description
**Test setup**
mosquitto broker listening on 1883
websockify websocket to TCP bridge set up to bridge public-ip:9001 to localhost:1883
sample page subscribing to broker via mqttws31.js
**What happens**
websockify refuses connection from client:
`host17-79-dynamic.183-80-r.retail... - - [31/Mar/2016 15:49:20] code 400, message Client must support 'binary' or 'base64' protocol`
**Solution**
I have been able to fix this issue by patching:
`this.socket = new WebSocket(wsurl, ["mqttv3.1"]);`
to:
`this.socket = new WebSocket(wsurl, ["binary"]);`
**Request**
still I think that a proper option could be added to paho.MQTT.Client class to support this scenario, something like:
`
var options = {
binaryMode: true,
`
or some explicit string option override.
thank you!
Contributor guide
Assessment
This issue has not been assessed yet.