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
Manav Mehta is currently offline Manav MehtaFriend
Messages: 4
Registered: December 2016
Junior Member
Hello,

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 test.mosquitto.org 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 config.mk 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.

Thanks.



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.

Previous Topic:Problem starting mosquitto automatically
Next Topic:TLS/SSL
Goto Forum:
  


Current Time: Tue Sep 25 17:21:15 GMT 2018

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

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

Back to the top