简体   繁体   English

Android-JavaPhoenixChannel-EPIPE(断线)

[英]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.

相关问题 Android错误:写入失败:EPIPE(管道断开) - Android error: write failed: EPIPE (Broken pipe) java.net.SocketException:sendto失败:Android上的EPIPE(管道断开) - java.net.SocketException: sendto failed: EPIPE (Broken pipe) on Android Android系统。 写入失败:使用过程时EPIPE(断管) - Android. write failed: EPIPE (Broken pipe) when use Process Android:写入失败:EPIPE(Broken pipe)写入文件出错 - Android: write failed: EPIPE (Broken pipe) Error on write file 上传时是EPIPE(断管)? - EPIPE (Broken pipe) while uploading? 具有拍摄意图的Android FileProvider给出java.io.IOException:写入失败:EPIPE(管道损坏) - Android FileProvider with photo take intent gives a java.io.IOException: write failed: EPIPE (Broken pipe) Android:套接字-java.net.SocketException:sendto失败:EPIPE(管道断开) - Android : Socket - java.net.SocketException: sendto failed: EPIPE (Broken pipe) 将Python客户端代码转换为Java(EPN)时发生EPIPE(断管)错误 - EPIPE(Broken Pipe) Error while converting Python client code to java(android) 无法将zip文件从Android上传到服务器sendto失败:Epipe(管道断开) - Unable to upload zip file from Android to server sendto failed: epipe (broken pipe) retrofit.RetrofitError:发送至失败:EPIPE(管道损坏) - retrofit.RetrofitError: sendto failed: EPIPE (Broken pipe)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM