Answer the question
In order to leave comments, you need to log in
Nodejs socketio how to properly push?
io.cookies = [];
io.parseCookies = function() {
console.log(this.cookies); // Возвращает [] в консоль
};
io.sockets.on('connection', function(socket) {
socket.on('auth', function(msg) {
var message = JSON.parse(msg);
io.cookies.push({'id': socket.id, 'user_id': message.id});
console.log(io.cookies); // Ничего не возвращает в консоль
io.parseCookies();
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question