Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

想问下服务器如何判断客户端掉线,然后通知他的好友 #245

Open
SwpuEsine opened this issue Dec 17, 2022 · 2 comments
Open

Comments

@SwpuEsine
Copy link

比如他5分钟不发消息,就认为他已经掉线了,就关闭链接,这个onclose方法是否可以设置客户端5分钟没法消息,服务器自动触发onclose方法,有没有配置啊

@YeautyYE
Copy link
Owner

可以配置allIdleTimeSeconds 属性,然后在 OnEvent 事件里面就有回调

@aazainn
Copy link

aazainn commented Jul 6, 2023

虽然作者回复了,但我这边也可以完善一下回答:如果要做5分钟没发消息就离线,readerIdleTimeSeconds设置为5分钟,然后onEvent,然后判断idleStateEvent.state()为READER_IDLE就关闭Session,就会自动触发onclose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants