Does anyone successfully implement WebSocket Server for Android?

I am trying to implement both a WebSocket client and a WebSocket server on a single Android device. Basically, I have two Android apps that need to communicate. I have implemented several test applications using LocalSockets successfully, but the target client application is a web browser application, so it can only use WebSockets.

I have tried implementing https://github.com/TooTallNate/Java-WebSocket . I have a Client application running in the foreground and a Server application running in the Android service in the background. Essentially, I accepted my LocalSocket implementations that work and replace LocalSockets with TooTallNate WebSockets. It looks like the WebSocket server is not starting. The obvious symptom is that the client side throws a NotYetConnectedException every time it tries to send something.

Another sign - 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. Thank you

+4
source share
1 answer

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

0
source

Source: https://habr.com/ru/post/1481656/


All Articles