不幸的是,socket.io开发团队决定弃用函数set()和get().问题是这两个函数允许我们将变量保存到会话中.
所以我的问题是:socket.io 1.0.5上的下列代码相当于什么?
socket.set('mySessionVar', 'myValue');
socket.get('mySessionVar', function (error, mySessionVar) {
console.log('I have a super variable save in the session : '+mySessionVar);
socket.emit('mySessionVar', mySessionVar);
});
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助,纪尧姆.