简体   繁体   English

与node.js服务器OpenShift建立连接时出错

[英]error while establishing connection with node.js server OpenShift

I am not managing to establish connection with the server is hosted in OpenShift. 我无法建立与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: OpenShift的连接是这样,但不起作用:

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. 客户端在我家中,服务器node.js在OpenShift中,但无法建立连接。

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 您需要侦听服务器上的端口8080(但要从客户端的端口8000进行连接),您可以在此处看到示例应用程序: 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 完整的仓库可以在这里找到: https : //github.com/openshift-quickstart/openshift-nodejs-http-and-websocket-example

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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