Skip to content

Commit

Permalink
The protocols parameter of wx.connectSocket should be Array. (mqttjs#969
Browse files Browse the repository at this point in the history
)

Wechat mini app document url:
https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.connectSocket.html.

If the protocols value is 'mqtt' instead of ['mqtt'], it will be failed if
you use the android device, the interesting thing is iOS works.

Both android and ios works if the value is an array.
  • Loading branch information
jerecui authored and Cédric von Allmen committed Nov 27, 2020
1 parent 0342c67 commit 67f061d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/connect/wx.js
Expand Up @@ -99,7 +99,7 @@ function buildStream (client, opts) {
var url = buildUrl(opts, client)
socketTask = wx.connectSocket({
url: url,
protocols: websocketSubProtocol
protocols: [websocketSubProtocol]
})

proxy = buildProxy()
Expand Down

0 comments on commit 67f061d

Please sign in to comment.