socket.io authentication after socket established
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on a small multiplayer game. I'd like to introduce authentication. I'm using Node.js and Socket.io. When the user arrives that the main page - I want them to join the game whether they are logged in or not - but they will be unable to do anything within it (only watch). How could I then go about authenticating the user on the already open socket? Could I maintain the authentication still if they left the site and came back? Can you pass a cookie through a web socket? EDIT To further my question. One of the possible thoughts I've