在我的 app.js 我有
var app = express();
var serv = http.createServer(app);
var io = require('socket.io').listen(serv);
io.sockets.on('connection', function(socket) {
//some code here
}
var SessionSockets = require('session.socket.io'),
sessionSockets = new SessionSockets(io, express_store, cookieParser);
sessionSockets.on('connection', function (err, socket, session) {
//set up some socket handlers here for the specific client that are
//only called when a client does a socket.emit.
//These handlers have access to io, sessionSockets, socket, session objects.
}
在处理不是由客户端触发而是由客户端 post/get 触发的 post/get 之后,快速路由如何访问特定客户端的套接字引用socket.emit
。确定路由中对象范围的最佳方法是什么,socket.io server(io/sessionSockets)/client(socket)
以便我可以轻松获取此客户端的套接字引用?