Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4726,14 +4726,19 @@ function createWebSocket (client, url, opts) {
}

function createBrowserWebSocket (client, opts) {
const websocketSubProtocol =
(opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
let websocketSubProtocols = [];

if (opts != undefined && opts.wsOptions !== undefined && opts.wsOptions.protocol !== undefined) {
websocketSubProtocols = opts.wsOptions.protocol.split(',');
}

websocketSubProtocols.push((opts.protocolId === 'MQIsdp') && (opts.protocolVersion === 3)
? 'mqttv3.1'
: 'mqtt'
: 'mqtt');

const url = buildUrl(opts, client)
/* global WebSocket */
const socket = new WebSocket(url, [websocketSubProtocol])
const socket = new WebSocket(url, websocketSubProtocols)
socket.binaryType = 'arraybuffer'
return socket
}
Expand Down Expand Up @@ -18671,4 +18676,4 @@ module.exports = {
};

},{}]},{},[17])(17)
});
});