floatinghotpot / socket.io-unity

socket.io client for Unity, power game client with node.js back-end
494 stars 76 forks source link

Connect to server hosted on Heroku failed #29

Open pampas93 opened 6 years ago

pampas93 commented 6 years ago

I hosted a server on heroku (node.js) which emits time in intervals (testing). It works when I test on http://amritb.github.io/socketio-client-tool/ but fails to connect while I run from Unity. local servers connect and receive data, but fails to connect to the server hosted on heroku.

This is the URL: https://socket-unity.herokuapp.com/

Any issue or I must be doing something wrong

floatinghotpot commented 6 years ago

Tips: check the server port, and whether allowed by firewall.

pampas93 commented 6 years ago

This is an online hosted server and connects when I tested on the socket.io client tool. This is my code,

socket = IO.Socket("https://socket-unity.herokuapp.com/");
socket.On(Socket.EVENT_CONNECT, () => {
        Debug.Log("Connected to server socket");
});

Is there any online hosted socket.io url that I can test with my Unity?

floatinghotpot commented 6 years ago

I see https://, but this plugin only support http so far.

Zbluu commented 6 years ago

I used Heroku too, juste replace "https://socket-unity.herokuapp.com/" by ""ws://socket-unity.herokuapp.com/", it's work for me. The first connection can also takes time if the server was in "sleeping mode", just wait for it to start.

pampas93 commented 6 years ago

Perfect. It works like a charm. Thanks