washo4evr / Socket.io-v1.x-Library

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

connectHTTP to Heroku #50

Closed hipotenusa closed 6 years ago

hipotenusa commented 6 years ago

After doing somel examples with the library on my local network, now I am trying to host the server in Heroku so I can access it worldwide. The testing app is already on the cloud and you can access it here: http://funny-led.herokuapp.com The toggle switch that apprears when opening the page is syncronized over the different opened pages of the app so it seems the socketio server is running fine. The problem I am facing is that I can not get the ESP8266 connected to socketio server. I have tried with:

char host[] = "funny-led.herokuapp.com"; int port = 1234;

with both connect and connectHTTP with no success I have also tried with including http:// on the URL but more of the same Also tried with the public IP of Heroku....same thing

Testing accessibility to the server I have done a GET of the styles.css file and I got the content so that was fine.

Any comment on what I am doing wrong would be much appreciated!!

Git repo is https://github.com/hipotenusa/funny-led

Thanks in advance

hipotenusa commented 6 years ago

Hi guys,

It´s working now.

First thing I was doing wrong was using connectHTTP. As I could see on its definition connectHTTP does not send the handshake authorization request to the SocketIO server.

Next thing is something that I stil need to investigate some further. Althought I had defined the listening port to 1234 on app.js, I can only get succesful connection if using port 80. It seems related with the way Heroku assign ports to the applications.

Issue can be closed

Thanks!