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

client长时间不发送数据,再次发送数据时session.sendText()无效 #20

Open
guoeq opened this issue Jan 5, 2019 · 2 comments

Comments

@guoeq
Copy link

guoeq commented Jan 5, 2019

client长时间不发送数据,再次发送数据时session.sendText()无效,重新关闭再打开时可用

@YeautyYE
Copy link
Owner

YeautyYE commented Jan 5, 2019

client长时间不发送数据,再次发送数据时session.sendText()无效,重新关闭再打开时可用

需要知道client长时间不发消息,连接是否被client主动断开了.

tips:每条连接对应着唯一一个session对象,也就是只要是同一条连接,在不同事件中的session都会是同一个对象.那么在连接断开时,@onclose事件也会把这个对象传进来,就可以进行连接断开的判断.另外,如果想要主动判断连接是否断开,可以使用session.isActive()

@CoyTatia
Copy link

你可以写个心跳去维持连接 或者C端端每隔一段时间就往S端发送消息 就可以维持连接了

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