Reputation: 10482
Here is my paho javascript client code
client = new Paho.MQTT.Client(host, Number(port), clientId);
client.onMessageArrived = onMessageArrived;
client.onMessageDelivered = onMessageDelivered;
client.onConnectionLost = onConnectionLost;
here port
8083
works with other broker but not with Rabbitmq. In the documentation I could not found any correct port number.
Running sudo rabbitmqctl status
gives
[{rabbitmq_management,"RabbitMQ Management Console","3.6.2"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.6.2"},
{webmachine,"webmachine","1.10.3"},
{mochiweb,"MochiMedia Web Server","2.13.1"},
{rabbitmq_mqtt,"RabbitMQ MQTT Adapter","3.6.2"},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"},{mqtt,1883,"::"}]},
So I tried with port 1883
also. I was following https://github.com/rabbitmq/rabbitmq-web-mqtt-examples/blob/master/priv/echo.html
I getting this error:
WebSocket connection to 'ws://localhost:1883/mqtt' failed: Connection closed before receiving a handshake response
Upvotes: 0
Views: 1435
Reputation: 59608
As thrashed out in the comments:
Rabbitmq requires the following plugin to support MQTT over websockets (http://github.com/rabbitmq/rabbitmq-web-mqtt)
Upvotes: 1