4

everyone!

I'm in an issue. I'm trying to connect in a server with my client application. My server is hosting by Modulus that have no port to access URL. When I try to call io('my-application.onmodulus.net'), the browser (chrome) returns me a failed GET net::ERR_CONNECTION_REFUSED with a PORT setted in GET URL.

I tested the URL without the PORT in the browse and works. There's a way to GET socket.io connect from then client without socket.io set a PORT in URL?

Here's my code:

I try of different ways to call this method, and I don't find OPTIONS parameter documentation.

var socket = io('my-application.onmodulus.net', {multiplex: false, path: '/socket.io'});

Thank you all so much!

rteixeira
  • 41
  • 3

1 Answers1

1

In socket.io, if you pass anything as the first argument to io() to specify the hostname, then it should be in URL form, not just a hostname.

If you don't pass anything (e.g. you just call io()), then socket.io will connect to the same host and port as the current web page.

So, you could use:

var socket = io('http://my-application.onmodulus.net/socket.io', {multiplex: false});

or, if you're connecting to the same host and port as your web page, you could just leave out the URL and use:

var socket = io({multiplex: false});
jfriend00
  • 683,504
  • 96
  • 985
  • 979