我想在Google App Engine(GAE)上部署Nodejs websocket应用程序,我在过去3天尝试过没有成功
我一直收到错误ERR_CONNECTION_TIMED_OUT
这是我在Nodejs中的app.js文件
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({ port: 65080 }),
CLIENTS = [];
console.log('WS listening on port 65080');
// on new connection
wss.on('connection', function (ws) {
console.log('incoming connection ....');
ws.id = uuid.v4();
CLIENTS.push(ws);
ws.send('{"type":"uuid","value":"' + ws.id + '"}');
});
我已成功打开防火墙端口,就像这样
这是我的app.yaml
runtime: nodejs
env: flex
api_version: 1
service: websockets
manual_scaling:
instances: 1
network:
forwarded_ports:
- 65080
session_affinity: true
instance_tag: websocket
任何建议都表示赞赏..
答案 0 :(得分:1)