我有mosquitto.config
listener 1885
allow_anonymous false
listener 9001 127.0.0.1
protocol websockets
user manish
auth_opt_backends postgres
auth_plugin /etc/mosquitto/auth-plug.so
auth_opt_dbname mqtt
#auth_opt_host localhost
#auth_opt_port 5432
auth_opt_user postgres
auth_opt_pass 123
auth_opt_userquery SELECT password FROM account WHERE username = $1 limit 1
auth_opt_superquery SELECT COALESCE(COUNT(*),0) FROM account WHERE username = $1 AND super = 1
auth_opt_aclquery SELECT topic FROM acls WHERE (username = $1) AND (rw >= $2)
当我进行网络套接字连接时,我在浏览器中收到此错误
Host=127.0.0.1, port=1885, path=/mqtt TLS = false username=u1 password=0123456789
paho.js:2067 Uncaught AMQJS0013E Invalid argument [object Object] for newPayload.Paho.MQTT.Message @ paho.js:2067MQTTconnect @ index.html:45(anonymous function) @ index.html:79m.Callbacks.j @ jquery-1.11.3.min.js:2m.Callbacks.k.fireWith @ jquery-1.11.3.min.js:2m.extend.ready @ jquery-1.11.3.min.js:2J @ jquery-1.11.3.min.js:2
paho.js:979 WebSocket connection to 'ws://127.0.0.1:1885/mqtt' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
paho.js:977 WebSocket connection to 'ws://127.0.0.1:1885/mqtt' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
答案 0 :(得分:2)
您使用错误的端口号
您已在9001上配置了Websockets,但您正尝试连接到端口1885