eclipse-paho / eclipse-paho/paho.mqtt.javascript

websockify support (websocket binary protocol)

Open
#57 5 comments 0 reactions 1 assignee Claimed by @jpwsutton View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.