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

我在服务里用netty写的长连接,每隔60s发送一次心跳,屏锁之后长连接会断开,这个要怎么解决? #16

Open
2697a opened this issue Jul 30, 2019 · 3 comments

Comments

@2697a
Copy link

2697a commented Jul 30, 2019

我在服务里用netty写的长连接,每隔60s发送一次心跳,屏锁之后长连接会断开,这个要怎么解决?

@ShihooWang
Copy link
Owner

1.屏锁之后服务是否继续运行?
2.屏锁之后是否可以访问网络?部分手机锁屏会自动断网。

@2697a
Copy link
Author

2697a commented Jul 30, 2019

我把文件日志写到本地文件,发现屏锁后服务还在运行,网络也是能访问的,应该是休眠导致socket心跳停止的,我刚才在收到服务器回应后执行了wakeLock.acquire();来唤醒设备,测试发现可以了,但是这个唤醒锁太耗电了

@ShihooWang
Copy link
Owner

做IM开发的兄弟都饱受此痛苦。。。

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

2 participants