任何人都成功地实现了Android的一个WebSocket的服务器? [英] Anyone successful in implementing a WebSocket Server for Android?

查看:1272
本文介绍了任何人都成功地实现了Android的一个WebSocket的服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图同时实现的WebSocket客户端和相同的Andr​​oid设备上的WebSocket服务器。基本上,我有两个需要通信的Andr​​oid应用程序。我已经实现了一个夫妇使用LocalSockets成功试射的应用程序,但目标客户端应用程序是一个Web浏览器应用程序,所以它只能使用WebSockets。

I'm trying to implement both the WebSocket Client and the WebSocket Server on the same Android device. Basically I have two Android apps that need to communicate. I've implemented a couple of test apps using LocalSockets successfully, but the target Client side app is a web browser app so it can only use WebSockets.

我试过 https://github.com/TooTallNate/Java-WebSocket 实现。我有客户端应用程序在前台运行,并在Android服务的服务器应用程序在后台运行。从本质上讲,我已把LocalSocket实现,工程和替换TooTallNate的的WebSockets的LocalSockets。看来,WebSocket的服务器无法启动。最明显的症状是客户端每次试图发送什么时候抛出NotYetConnectedException。

I've tried the https://github.com/TooTallNate/Java-WebSocket implementation. I have the Client app running in the foreground and the Server app running in an Android Service in the background. Essentially, I've taken my LocalSocket implementations that works and replaced the LocalSockets with TooTallNate's WebSockets. It appears that the WebSocket Server is failing to start. The obvious symptom is that the Client side throws a NotYetConnectedException every time it tries to send something.

另一个症状是,如果我尝试使用WebSocketServer.run()而不是WebSocketServer.start()我从ServerSocketChannel.open()。

Another symptom is if I try to use WebSocketServer.run() instead of WebSocketServer.start() I get an IOException from ServerSocketChannel.open().

任何想法当然欢迎这一点。谢谢!

Any ideas are certainly welcome at this point. Thanks!

推荐答案

尝试的WebSocket和Socket.io为Android?
https://github.com/koush/android-websockets

Try WebSocket and Socket.io for Android? https://github.com/koush/android-websockets

这篇关于任何人都成功地实现了Android的一个WebSocket的服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆