washo4evr / Socket.io-v1.x-Library

Socket.io Library for Arduino
108 stars 58 forks source link

Fail to change port to 80 #32

Open DaniloFeng opened 7 years ago

DaniloFeng commented 7 years ago

Firstly, my congratulations for the library! It's best way to get rid of MQTT and use socket.io everywhere.

I used your example in localhost with port 3484 and works fine. But my cloud server don't accept other port to listen.

I changed both in your app.js and Hello_Time_ESP8266.ino the number of port to 80 and the ESP connect and disconnect sequentially.

[readHandshake] Connected. SID=o6lx5IknVIMyIdcLAAAw
[readHandshake] Websocket failed.[monitor] Can't connect. Aborting.
[monitor] Client not connected.

Do you have suggestions to solve this problem?

washo4evr commented 7 years ago

Hey, Thank you for your message just to be sure, you have to change the port in 3 different locations, depending on how you use it: app.js Hello.ino index.html

also, could it be firewall / router related? is your cloud server hosted locally or remote?

DaniloFeng commented 7 years ago

Thank you for your attention and for responding quickly.

Initially, I did trying in localhost and in test with socket.io tester the server is working fine.

The port I use the same to .ino and app.js, and the stranger that in the tests only on port 80, 8080, 8000 and others popular ports don't work.

Probably some firewall, etc., but i have many servers with socket.io and none gave this kind of problem.

My Cloud Server is basied with OpenShift and don't have a possible to change the port.

For my project don't stop, I used the WebSocketClient library and altered my cloud server to ws module. And works well!

I did try to use the Chrome Console URL (http://youraddress.com/socket.io/?EIO=3&transport=websocket) and in the socket.io tester works fine, but on the ESP8266 connect when receiving the first message it disconnects.

washo4evr commented 7 years ago

Hi, glad to see your made it work

as for the chrome console, I never used it I think I usually rely on wireshark wwhen Im debugging / working on the library

JasXSL commented 6 years ago

I'm having the same issue. Connecting via IP works fine. I can also connect through a browser with io('http://mydomain.com'); including socket.io from a CDN. It also worked fine to connect from a raspberry pi using only the socket.io client library.

But when I try to specify host as my domain, it won't connect. Using ESP32

JasXSL commented 6 years ago

Found the issue. Leave out http:// and it'll work.