Java (Android) WebSocket 客户端库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23805635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java (Android) WebSocket Client Libraries
提问by RevMoon
There are some libraries to implement WebSocket usage in an unobtrusive fashion. Apparently, there are many libraries out, but what I really looking is a modern and small library which I can use on Android or Java in generall to implement my WebSocket usage from the client side.
有一些库可以以不显眼的方式实现 WebSocket 的使用。显然,有很多库,但我真正想要的是一个现代的小型库,我可以在 Android 或 Java 上使用它来从客户端实现我的 WebSocket 使用。
So far I have found:
到目前为止,我发现:
I am missing a bit the differences of the differnet libraries. JAX-RS 2.0 for instance seems to be a great foundation for a lot of implementations, but I also went with Square's Retrofit for my RESTful Client because it was just leaner and easy to integrate.
我有点遗漏了不同库的差异。例如,JAX-RS 2.0 似乎是许多实现的良好基础,但我也为我的 RESTful 客户端使用了 Square 的 Retrofit,因为它更精简且易于集成。
回答by khurram
I just work on one of my first web socket app in android. So I do lot of R&D before I starting and at last I found these two libs are very simple and useful for my requirement.
我只是在 android 中开发我的第一个 web socket 应用程序。所以我在开始之前做了很多研发,最后我发现这两个库非常简单并且对我的要求很有用。
1 ) AndroidAsync (For clients )
1)AndroidAsync(客户端)
2 ) Java-WebSocket (https://github.com/TooTallNate/Java-WebSocket) for Server
2 )用于服务器的Java-WebSocket(https://github.com/TooTallNate/Java-WebSocket)
Both are very simple and easy to use.
两者都非常简单且易于使用。