Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websockets Listener on Windows permanently bound to localhost - V1.5.3 #1005

Closed
firegood opened this issue Oct 30, 2018 · 14 comments
Closed
Milestone

Comments

@firegood
Copy link

Hello,

I just did a fresh install on a Windows server 2016 box and I am having an issue with the websockets functionality. I did install openSSL Light (x64) per the readme - and I also installed Visual studio 2013 redist (x64)

My config is default, with the following additions:

port 1883
protocol mqtt
listener 1884
protocol websockets

The program starts and shows that it is listening:

c:\Program Files\mosquitto>mosquitto.exe -v -c mosquitto.conf
1540920694: mosquitto version 1.5.3 starting
1540920694: Config loaded from mosquitto.conf.
1540920694: Opening websockets listen socket on port 1884.
1540920694: Opening ipv4 listen socket on port 1883.

Netstat -a shows that 1883 is listening on all ip addresses, but 1884 is only listening on localhost. This is confirmed by my web application that is only able to connect to port 1884 via localhost.

Proto Local Address Foreign Address State
TCP 0.0.0.0:1883 HOME:0 LISTENING
TCP [::]:1883 HOME:0 LISTENING
TCP [::]:1884 HOME:0 LISTENING

I also tried the following in my mosquitto config:

bind_address 192.168.10.10
port 1883
protocol mqtt

listener 1884 192.168.10.10
protocol websockets

But that dosent seem to work

Proto Local Address Foreign Address State
TCP 192.168.10.10:1883 HOME:0 LISTENING
TCP [::]:1884 HOME:0 LISTENING

@realgsg
Copy link

realgsg commented Oct 31, 2018

I have encountered this problem, but I don't know how to solve it.

you can run the program like the following in the command line,try Netstat -a again
mosquitto -p 1884

the port 1884 will be opened, but my client couldn't connect to the broker~

@stoinov
Copy link

stoinov commented Nov 3, 2018

This seems like a duplicate to #1004

@ralight
Copy link
Contributor

ralight commented Nov 4, 2018

I don't think it is necessarily a duplicate. This is Windows, 1004 isn't. 1004 is using libwebsockets 3.0.0, we have 2.4.2 on Windows. It might be that they are a duplicate after all, but for the moment I'd prefer to keep this open and separate.

@ralight
Copy link
Contributor

ralight commented Nov 4, 2018

In particular, Windows is not supported by the libwebsockets author, he relies entirely on contributions which means there is a reasonable amount of difference in behaviour between Windows/other systems.

@joseguatume
Copy link

i have the same issue, i just able to make conection over the websokects this way:
---------------------- Js------------------------------
var reconnectTimeout = 2000;
var host = "localhost";
var port = 9001;

var mqtt = new Paho.Client(host,port, "Clientjs");

if i use as host the ip address (192.168.1.101) or (127.0.0.1), it doesn't connect
i am not a native speaker english so forgive me for my mistake

@ralight
Copy link
Contributor

ralight commented Nov 7, 2018

Could you please try with this file?

https://mosquitto.org/files/binary/win32/mosquitto-1.5.3a-install-windows-x64.exe

It seems as though if libwebsockets is compiled with IPv6 support then it binds to localhost. That installer has no mosquitto changes, but has a libwebsockets without IPv6 support. It works for me.

@ralight
Copy link
Contributor

ralight commented Nov 7, 2018

sha512: 77b3e072e352cfc1e186a0fd0bca1af62a7dc7fffd602d4feb76f73900a5d154ff708400e8e097778b1fb8756f3c1a7ac2b1dbf48805a7edfe37f46c57065a1d mosquitto-1.5.3a-install-windows-x64.exe

@ralight ralight added this to the 1.5.4 milestone Nov 7, 2018
@ralight ralight added the Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer. label Nov 7, 2018
@joseguatume
Copy link

there is this file but for windows x86 ?

@realgsg
Copy link

realgsg commented Nov 8, 2018

@ralight thank you so much! file mosquitto-1.5.3a, it works for me! can you share the version for windows x86 please?

@ralight
Copy link
Contributor

ralight commented Nov 9, 2018

There is now 1.5.4 available with both x86 and x64.

@joseguatume
Copy link

i still have the same issue, i cant change the ip address of websockets

@realgsg
Copy link

realgsg commented Nov 10, 2018

I have updated the version 1.5.4 x86, but I still have the same problem.

@satsdeva
Copy link

satsdeva commented Nov 14, 2018

updated the version to 1. 5.4..

Config file:

port 8883
protocol mqtt
cafile C:\Program Files (x86)\mosquitto\certs\ca.crt
keyfile C:\Program Files (x86)\mosquitto\certs\server.key
certfile C:\Program Files (x86)\mosquitto\certs\server.crt
require_certificate false
tls_version tlsv1

listener 9883
protocol websockets
cafile C:\Program Files (x86)\mosquitto\certs\ca.crt
keyfile C:\Program Files (x86)\mosquitto\certs\server.key
certfile C:\Program Files (x86)\mosquitto\certs\server.crt
require_certificate false
tls_version tlsv1

log_type all
websockets_log_level 255


Getting below error :
C:\Program Files (x86)\mosquitto>mosquitto.exe -v -c mosquitto.conf
1542182927: mosquitto version 1.5.4 starting
1542182927: Config loaded from mosquitto.conf.
1542182927: Opening websockets listen socket on port 9883.
1542182927: libuv support not compiled in
1542182927: Creating Vhost 'default' port 9883, 3 protocols, IPv6 on
1542182927: Using SSL mode
1542182927: SSL ECDH curve 'prime256v1'
1542182927: ERROR on binding fd 296 to port 9883 (-1 10048)
1542182927: init server failed
1542182927: Failed to create default vhost
1542182927: Error: Unable to create websockets listener on port 9883.

@ralight ralight removed the Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer. label Nov 20, 2018
@ralight ralight modified the milestones: 1.5.4, 1.5.5 Nov 20, 2018
@ralight
Copy link
Contributor

ralight commented Dec 5, 2018

I believe this should work on the upcoming 1.5.5 if you use:

socket_domain ipv4

in your config file.

@ralight ralight closed this as completed Dec 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants