简体   繁体   English

Java socket.io 客户端

[英]Java socket.io client

Is there any Socket.IO-client available for Java?是否有任何可用于 Java 的 Socket.IO 客户端? So far I have only found the official Socket.IO client which is only available for JavaScript and socket.io-java which is only the server.到目前为止,我只找到了仅适用于 JavaScript 的官方 Socket.IO 客户端和仅用于服务器的 socket.io-java。

Limited options at this time:目前有限的选择:

sound right as far as WebSockets go.就 WebSockets 而言听起来不错。 Socket.IO's specific wire protocol do not appear to have been implemented in Java yet, so you may have to deal with that yourself. Socket.IO 的特定有线协议似乎尚未在 Java 中实现,因此您可能必须自己处理。

Judging from http://socket.io under "Supported Transports" it could be several different transport protocols:从“支持的传输”下的http://socket.io判断,它可能是几种不同的传输协议:

WebSocket, Adobe® Flash® Socket, AJAX long polling, AJAX multipart streaming, Forever Iframe, JSONP Polling WebSocket、Adobe® Flash® Socket、AJAX 长轮询、AJAX 多部分流、Forever Iframe、JSONP 轮询

So, the question is, what is your server supporting?所以,问题是,你的服务器支持什么?

From the perspective of Java clients the easiest would be WebSockets.从 Java 客户端的角度来看,最简单的方法是 WebSockets。

如果您需要客户端实现,请查看 java-socket.io.client 我几个月前制作的,我相信有些人已经分叉并将其升级到最新版本: https ://github.com/clwillingham/java -socket.io.client

You can use socket.io-client.java.您可以使用 socket.io-client.java。

See this link for src code.请参阅此链接以获取 src 代码。

You can also find a tutorial here您还可以在此处找到教程

Take a look athttp://techdroid.kbeanie.com/2011/03/websockets-on-android.html .看看http://techdroid.kbeanie.com/2011/03/websockets-on-android.html I only needed the WebSockets, so I stripped out the WebView part as well, the Factory was superfluous also.我只需要 WebSockets,所以我也去掉了 WebView 部分,Factory 也是多余的。 You can just get away with using https://github.com/anismiles/websocket-android-phonegap/blob/master/src/com/strumsoft/websocket/phonegap/WebSocket.java and implement the SocketIO specifcs yourself.您可以使用https://github.com/anismiles/websocket-android-phonegap/blob/master/src/com/strumsoft/websocket/phonegap/WebSocket.java并自己实现 SocketIO 规范。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM