Node.js 套接字io.connect即使在端口启用后也不工作
我连接套接字的代码是:Node.js 套接字io.connect即使在端口启用后也不工作,node.js,socket.io,Node.js,Socket.io,我连接套接字的代码是: var socket = io.connect('http://localhost:3003', { query: $.param({des: user_info, pic: user_pic}) ] }) 它在本地系统上工作,但在aws服务器上不工作,因为我启用了端口3003 服务器代码-- 这个=>http://localhost:3003在AWS中工作?不,不是在AWS中工作,我在AWS中尝试过1)“ws://my A
var socket = io.connect('http://localhost:3003', {
query: $.param({des: user_info, pic: user_pic})
] })
它在本地系统上工作,但在aws服务器上不工作,因为我启用了端口3003
服务器代码--
这个=>
http://localhost:3003
在AWS中工作?不,不是在AWS中工作,我在AWS中尝试过1)“ws://my AWS ip:3003”2“3)”,但在点击“npm start”后,它会一直到app.get('/',function(req,res){res.sendFile(u dirname+'/index.html');});您是否尝试过“”?是的,尝试过,但工作到,app.get('/',function(req,res){res.sendFile(uu dirname+'/index.html');});但无法在io.on('connection',function(socket){}之间进行:
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
//var find = require('array-find');
var port = process.env.PORT || 3003;
var all = [];
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function (socket) {
// not comming here
});