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

断网后判断是否连接状态 #19

Open
huangliqiang opened this issue May 17, 2018 · 3 comments
Open

断网后判断是否连接状态 #19

huangliqiang opened this issue May 17, 2018 · 3 comments

Comments

@huangliqiang
Copy link

部分手机断网或者更改网络后,socket不会受到close 或者 fail回调,这种情况怎么判断是否已连接状态呢?因为调用send方法会retrun true,实际上无法发送消息和无法接受消息

@JerryChaox
Copy link

双方心跳 ping pong

@kong-jing
Copy link

可以使用websocket的 send 方法,查看 发送后的 Boolean值

@yanpengqing
Copy link

ping pong具体怎么实现?安卓端websocket初始化的时候new OkHttpClient.Builder().pingInterval(5, TimeUnit.SECONDS).build() , 那服务端具体怎么判断?

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

4 participants