Reputation: 10502
I have this 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)
when i do web socket connection i am getting this error in browser
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
Upvotes: 2
Views: 8145
Reputation: 59658
Your using the wrong port number
You have configured Websockets on 9001 but you are trying to connect to port 1885
Upvotes: 2