这是我的paho javascript客户端代码
client = new Paho.MQTT.Client(host, Number(port), clientId);
client.onMessageArrived = onMessageArrived;
client.onMessageDelivered = onMessageDelivered;
client.onConnectionLost = onConnectionLost;
此处port
8083
与其他经纪人合作,但不与Rabbitmq合作。在文档中我找不到任何正确的端口号。
正在运行sudo rabbitmqctl status
[{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,"::"}]},
所以我也尝试使用端口1883
。我关注https://github.com/rabbitmq/rabbitmq-web-mqtt-examples/blob/master/priv/echo.html
我收到此错误:
WebSocket连接到' ws:// localhost:1883 / mqtt'失败:在收到握手响应之前关闭连接