我用websocket模块,在本地测试没用问题,发布到 appfog 后为什么建立不起ws 连接?
@booxood socket = io.connect(‘http://’ + host, {’connect timeout’:4000,reconnect:false,’try multiple transports’:false}); 我是这样的,我也试过其它组合,求指点。服务端用不用设置一下呢
@booxood 是的 地址没有问题的 下面是报错:WebSocket connection to ‘ws://showenchatapp.aws.af.cm/socket.io/1/websocket/auXRz_1IMKI7MteMXrxr’ failed: Unexpected response code: 502
这是我服务端的代码:
var ser=http.createServer(function(request,response)
{
var pathName=url.parse(request.url).pathname;
logger.debug("Request for “+pathName+” received. "+ (++i)); route(handle, pathName, response, request); }).listen(4567);
soceketIO=socket_io.listen(ser);
//var host = 'http://localhost:8080’; var host = 'xxx.ap01.aws.af.cm’; var socket = io.connect(host);
我是就这样