A
A
Alexander Fedoruk2016-05-03 18:23:15
JavaScript
Alexander Fedoruk, 2016-05-03 18:23:15

How to connect socket.io to openshift?

Created a small nodejs + express page using socket.io.
NodeJS server loaded on OpenShift, did everything according to the manual, the server starts up and works. However, when I try to connect to the server from my page, I get an error: net::ERR_CONNECTION_REFUSED.
It is important that I do not download the client page from the server, but store it on the local computer (this is how it should be, well, you should at least die).
I write in the client: var socket = io('http:// IP of my server : 8080'); .
And it doesn't work, help t_t

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
catHD, 2016-05-04
@AlexSaFF

var socket = io();
By default, the socket will connect to where it "arrived" from.
IO(url:String, opts:Object):Socket
Exposed as the io global in window if using the standalone build (eg: /socket.io/socket.io.js or the CDN), or the result of calling require(' socket.io-client').
When called, it creates a new Manager for the given URL, and attempts
to reuse an existing Manager for subsequent calls, unless the
multiplex option is passed with false. Passing this option is the equivalent of passing 'force new connection': true.
The rest of the options are passed to the Manager constructor (see below
for details).
A Socket instance is returned for the namespace specified by the
pathname in the URL, defaulting to /. For example, if the url is
localhost/users, a transport connection will be established to
localhost and a Socket.IO connection will be established to
/users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question