2

I have a server with fully working wildcard SSL, but socket.io give me error:

Failed to load resource: net::ERR_CONNECTION_CLOSED

On the client side im connecting to the socket like that:

var socket = io.connect('http://pricer.somedomain.com',{secure: true, port:5005});

Server Side:

var io                      = require('socket.io').listen(5005);

What am i doing wrong?

aviv a
  • 21
  • 1
  • 2
  • does it work if you use `{secure: false, port: 5005}`? – Roland Starke Feb 24 '16 at 14:30
  • @RolandStarke all the website is https, so i cant load un secured scripts – aviv a Feb 24 '16 at 14:50
  • for testing you could disable this feature (in firefox for example with about:config then search for: "mixed_content" and set the values to false) – Roland Starke Feb 24 '16 at 14:56
  • For those without a wildcard SSL, the socket.io connection on the client can't specify a port -- so socket.io must share the port of the express server ([how to do it for express](https://stackoverflow.com/a/44436553/1467306)). For debugging, you can avoid using SSL by allowing mixed content in the browser ([how to do it for chrome](https://stackoverflow.com/a/24434461/1467306)). – Edward Newell Sep 19 '17 at 02:48

1 Answers1

3

Your client need to connect through https://, not http://

var socket = io.connect('https://pricer.somedomain.com',{secure: true, port:5005});

I had the same problem yesterday, check on my topic.

Community
  • 1
  • 1
Gregor Mountain
  • 213
  • 1
  • 2
  • 9