作者:菲呀菲呀飞呀 | 来源:互联网 | 2023-06-24 22:08
Iambuildingsimplestudyingchatapplicationusingnode.jsexpressframework.AndIhaveoneprobl
I am building simple studying chat application using node.js express framework. And I have one problem. If user have multiple tabs active, and he logs out on one tab. I want to close connection to other tabs and make redirect to login page. But I've met a problem. Even if user has logged out other sockets session is not changed(I am using passport.socketio package, so I have current user at socket.handshake.user). What I am doing wrong? Thanks in advance.
我正在使用node.js表达框架构建简单的学习聊天应用程序。我有一个问题。如果用户有多个选项卡处于活动状态,则他会在一个选项卡上注销。我想关闭与其他标签的连接,并重定向到登录页面。但我遇到了一个问题。即使用户已注销其他套接字会话未更改(我使用的是passport.socketio包,因此我在socket.handshake.user中有当前用户)。我做错了什么?提前致谢。
2 个解决方案