简体   繁体   中英

error while establishing connection with node.js server OpenShift

I am not managing to establish connection with the server is hosted in OpenShift.

the connection server is this:

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

client connection to is this one:

var socket = io.connect('http://localhost:8000');

the connection of OpenShift is this but not working:

var socket = io.connect('http://server-xatevo.rhcloud.com:8000');

the client is in my house and the server node.js this in OpenShift but can't establish a connection.

You need to listen on port 8080 on your server (but connect from your client on port 8000), you can see an example application here: https://github.com/openshift-quickstart/openshift-nodejs-http-and-websocket-example/blob/master/server.js

The full repo is available here: https://github.com/openshift-quickstart/openshift-nodejs-http-and-websocket-example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM