我连接套接字的代码是:
var socket = io.connect('http://localhost:3003', {
query: $.param({des: user_info, pic: user_pic})
] })
这是在本地系统工作,但在aws服务器上它没有工作,因为我启用了端口3003.
服务器代码 -
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
});