DWR 和 Android 浏览器的问题
我在从 Android 浏览器访问应用程序时遇到问题。 应用程序使用 DWR 来保持与与其连接的客户端的连接。
一切对我来说都工作正常,除了如果应用程序在 2 分钟内没有向 Android 手机上的客户端发送任何数据,则连接似乎会丢失并且没有数据到达客户端。 同样的场景在 Firefox、Opera 和 Chrome 上运行得很好。 如果两次数据传输之间的暂停时间少于 2 分钟,则效果很好。
所以,现在我的问题是: 我缺少的 Android 浏览器是否有一些超时设置? 或者这是一些我无法规避的内置错误/功能/其他内容?
我知道我可以通过某种心跳来防止这种情况发生,我只是想知道为什么会发生这种情况。
预先感谢,Max
顺便说一句:一切(服务器,客户端)都在我的机器上运行,我正在使用 Windows XP 的 Android 模拟器上测试它
Android emulator version 1.10 (build_id CUPCAKE-150240)
I am experiencing a problem with accessing an application from the Android-browser.
The application uses DWR to persist connections to the clients that are connected with it.
Everything works fine for me, except that if the application does not send any data to the client on the Android-phone for 2 minutes, the connection seems to be lost and no data arrive at the client. The same scenario works just fine on Firefox, Opera and Chrome. If the pause between two data transfers is less than 2 minutes, it works just fine.
So, now my question:
Is there some timeout setting for the android browser that I am missing? Or is this some built-in bug/feature/whatever that I cannot circumvent?
I know that I could prevent this from happening with some sort of heartbeat, I would just like to why this is happening.
Thanks in advance, Max
btw: Everything (server, clients) runs on my machine and I am testing this on the android emulator with Windows XP
Android emulator version 1.10 (build_id CUPCAKE-150240)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
难道 Android 系统正在垃圾收集您的活动,从而丢失您的网络浏览器并关闭持久连接?
也许你可以通过查看 logcat (在 android 端)或 web 服务器日志(在远程端)来检查这一点?
如果是这种情况,您需要将重新连接代码添加到 android 中的 onresume/onstart 方法中。
Could it be that the Android system is garbage collecting your activity and thus loosing your web browser and closing the persistent connection?
Perhaps you could check this by looking in you logcat (on android end) or webserver logs (on remote end)?
if this is the case, you would need to add reconnect code into the onresume/onstart method in android.