Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » Unable to connect to Mosquitto over Websocket(Cannot connect to Mosquitto over Websocket)
Unable to connect to Mosquitto over Websocket [message #1749746] Sat, 10 December 2016 19:16 Go to next message
Manav Mehta is currently offline Manav MehtaFriend
Messages: 4
Registered: December 2016
Junior Member

I am unable to connect to my local Mosquitto 1.4.10 broker from a JavaScript client over a websocket.

The same JavaScript client is successfully connecting to the public broker at on port 8080 over a websocket.

The MQTT protocol connection on port 1883 is working fine, which I tested using mosquitto_pub and mosquitto_sub.

My broker is set up within a VirtualBox running Ubuntu 14.04.

I have libwebsockets installed on the same virtual machine.

My local broker was compiled with WITH_WEBSOCKETS:=yes in the file

I am loading the JavaScript client web page from the same virtual machine from a Firefox browser and seeing the following error message in the browser console:
Firefox can't establish a connection to the server at ws://localhost:8080/mqtt

Your suggestions on fixing this will be greatly appreciated.


Here is my Mosquitto .conf file:
port 1883

listener 8080
protocol websockets

log_type all
websockets_log_level 1023
connection_messages true

Here is the Mosquitto server's log (with websockets logging level set to 1023, and verbose logging turned on - no messages appear when I load the JavaScript web page):
1481381105: mosquitto version 1.4.10 (build date 2016-12-10 18:47:37+0530) starting
1481381105: Config loaded from /etc/mosquitto/mosquitto.conf.
1481381105: Opening websockets listen socket on port 8080.
1481381105: Initial logging level 1023
1481381105: Libwebsockets version: 2.1.0 manavkumarm@manav-alljoyn-
1481381105: IPV6 not compiled in
1481381105: libev support not compiled in
1481381105: libuv support not compiled in
1481381105:  Threads: 1 each 1024 fds
1481381105:  mem: platform fd map:  4096 bytes
1481381105:  Compiled with OpenSSL support
1481381105: Creating Vhost 'default' port 8080, 3 protocols, IPv6 off
1481381105:  Using non-SSL mode
1481381105:  Listening on port 8080
1481381105:  mem: per-conn:          376 bytes + protocol rx buf
1481381105:  canonical_hostname = mqtt
1481381105: Opening ipv4 listen socket on port 1883.
1481381105: Opening ipv6 listen socket on port 1883.

Re: Unable to connect to Mosquitto over Websocket [message #1814888 is a reply to message #1749746] Sat, 21 September 2019 17:28 Go to previous messageGo to next message
sumer bains is currently offline sumer bainsFriend
Messages: 1
Registered: September 2019
Junior Member

Manav, i am facing the same issue. Were you able to resolve your issue and if so, how?

Re: Unable to connect to Mosquitto over Websocket [message #1833361 is a reply to message #1814888] Sun, 11 October 2020 10:14 Go to previous message
smitz K is currently offline smitz KFriend
Messages: 1
Registered: October 2020
Junior Member
I am facing the same issue..could anybody help me with the solution?TIA
Previous Topic:MQTT BLE gateway
Next Topic:[Student] Will my simple scalable IoT platform work?
Goto Forum:

Current Time: Wed Dec 02 01:28:35 GMT 2020

Powered by FUDForum. Page generated in 0.01465 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top