[英]Android - JavaPhoenixChannel - EPIPE (Broken pipe)
I'm trying to use JavaPhoenixChannels ( https://github.com/eoinsha/JavaPhoenixChannels ) to connect a custom chat server. 我正在尝试使用JavaPhoenixChannels( https://github.com/eoinsha/JavaPhoenixChannels )连接自定义聊天服务器。
I connect socket and it throws an exception with the message sendto failed: EPIPE (Broken pipe)
after 5 seconds (with master
version). 我连接了套接字,它抛出异常,并发送消息
sendto failed: EPIPE (Broken pipe)
5秒后(使用master
版本)出现sendto failed: EPIPE (Broken pipe)
)。
When I use v0.2.0
version, the socket is closed with code 1011
. 当我使用
v0.2.0
版本时,使用代码1011
关闭了套接字。 I've seen the meaning of this code 我已经看到了这段代码的含义
1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
1011表示服务器正在终止连接,因为它遇到了阻止其满足请求的意外状况。
I'm following the README
sample to create the connection. 我正在按照
README
示例创建连接。 What could be wrong? 有什么事吗 We've tested the socket server with iOS and it works.
我们已经使用iOS测试了套接字服务器,并且可以正常工作。
final String SOCKET_URL_TEMPLATE = "ws://socket.test.com/socket/websocket?token=%s&vsn=2.0.0";
String url = String.format(SOCKET_URL_TEMPLATE, "token_xpto");
socket = new Socket(url);
socket.onOpen(new ISocketOpenCallback() {
@Override
public void onOpen() {
Log.d("[SOCKET_TEST]", "socket opened");
//this part connects and join the channel, but the error occurs even without this part
//simpleChannelConnection();
}
});
socket.onClose(new ISocketCloseCallback() {
@Override
public void onClose() {
Log.d("[SOCKET_TEST]", "socket closed");
}
});
socket.onError(new IErrorCallback() {
@Override
public void onError(String s) {
Log.d("[SOCKET_TEST]", "socket error - " + s);
}
});
socket.onMessage(new IMessageCallback() {
@Override
public void onMessage(Envelope envelope) {
Log.d("[SOCKET_TEST]", "socket message - " + envelope.toString());
}
});
socket.reconectOnFailure(false);
socket.connect();
Thank you. 谢谢。
Luis 路易斯
I've discovered the problem. 我发现了问题。 It was the server's version that original lib supports.
它是原始lib支持的服务器版本。
Fortunately, there's a fork that have already done this update. 幸运的是,已经有一个分支完成了此更新。
https://github.com/amensia/JavaPhoenixChannels https://github.com/amensia/JavaPhoenixChannels
Thank you. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.