Ответ 1
События сокета должны обрабатываться правильно, в любом случае, если событие не обрабатывается, ответа не будет.
var io = require('socket.io')(server);
var sessionMiddleWare=(session({secret: 'secret key', resave: true, saveUninitialized: true,cookie: { path: '/', httpOnly: true, maxAge: 300000 },rolling: true}));
app.use(sessionMiddleWare)
io.use(function(socket, next) {
sessionMiddleWare(socket.request, socket.request.res, next);
});
io.on('connection', function(socket) { // On Socket connection.
// inside this you can use different events
//event name and parameters can be found in socket variable.
console.log(socket.id) // prints the id sent from the client.
console.log(socket.data) // prints the data sent from the client.
// example event
socket.on('subscribe', function(room) { // Event sample.
console.log('joining room', room);
socket.room=room;
socket.join(room);
});
})
Надеюсь, что это поможет.