Android WebView 中的 WebSocket [英] WebSocket in Android WebView
问题描述
今天我的问题是我正在开发一个使用 WebSocket 的应用程序.在 iOS 上一切正常,但在 android 上,WebView 不支持 WebSocket.解决这个问题的最快/最优雅的方法是什么?
today my problem is that I am developing an app that is using a WebSocket. On iOS everything is working out fine but on android the WebView doesn't support the WebSocket. Whats the fastest/most elegant way to solve this problem?
由于这篇文章经常被查看,我想分享一些可能的解决方案.
As this post is viewed quite often I want to share some possible solutions.
解决方案:
- Java Websocket 客户端实现 &JavaScript 接口
- PHP Websocket 客户端实现&向 PHP 脚本发出背景(即 jQuery GET)请求(对我有用,因为我只想发送一行消息.)
Android Websocket 库
有人遇到了同样的问题并描述了他的工作方式
推荐答案
Android webview 不支持 WebSocket.所以你需要用一些WebSocket库来实现.
Android webview doesn't accommodate WebSocket. So you need to implement with some WebSocket library.
jWebSockethttp://jwebsocket.org/
weberknechthttp://code.google.com/p/weberknecht/
weberknecht http://code.google.com/p/weberknecht/
这篇关于Android WebView 中的 WebSocket的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!