diff --git a/lib/connect/ws.js b/lib/connect/ws.js index 81e91b7af..e5d6f0440 100644 --- a/lib/connect/ws.js +++ b/lib/connect/ws.js @@ -43,7 +43,7 @@ function buildBuilderBrowser(mqttClient, opts) { , port = opts.port , url = opts.protocol + '://' + host + ':' + opts.port - return websocket(url); + return websocket(url, 'mqttv3.1'); } if (process.title !== 'browser') { diff --git a/test/browser/server.js b/test/browser/server.js index 46db1adbc..d395285c3 100644 --- a/test/browser/server.js +++ b/test/browser/server.js @@ -98,6 +98,10 @@ function start(port, done) { var wss = new WebSocketServer({server: server}); wss.on('connection', function(ws) { + if (ws.protocol !== 'mqttv3.1') { + return ws.end(); + } + var stream = websocket(ws); var connection = new Connection(stream); handleClient(connection); @@ -120,6 +124,6 @@ if (require.main === module) { console.error(err); return; } - console.log('tunnelled server started on port', port); + console.log('tunnelled server started on port', process.env.PORT || process.env.ZUUL_PORT); }); }