How to close reconnect SocketIOClient on android?

Posted by erginduran on Stack Overflow See other posts from Stack Overflow or by erginduran
Published on 2014-08-23T16:16:00Z Indexed on 2014/08/23 16:20 UTC
Read the original article Hit count: 179

Filed under:
|
|
|

My problem is reconnect.I connect SocketIOClient.connect(..) in background service.I close service when internet connection is off.and I re-start service again connection on.

How to close this reconnection?I don't want to reconnect SocketIOClient.
Its my code:

    ConnectCallback mConnectCallback = new ConnectCallback() {

    @Override
    public void onConnectCompleted(Exception ex, SocketIOClient client) {

        if (ex != null) {
            ex.printStackTrace();
            return;
        }
        client.setReconnectCallback(new ReconnectCallback() {

            @Override
            public void onReconnect() {
                // TODO Auto-generated method stub
            }
        });
        client.setDisconnectCallback(new DisconnectCallback() {

            @Override
            public void onDisconnect(Exception arg0) {
                // TODO Auto-generated method stub

            }
        });
        client.setErrorCallback(new ErrorCallback() {

            @Override
            public void onError(String arg0) {
                // TODO Auto-generated method stub

            }
        });

        client.on("event", new EventCallback() {
            @Override
            public void onEvent(JSONArray jsonArray, Acknowledge acknowledge) {
                ///bla bla
            }
        });

        ScreenChat.mClient = client;

    }

};

© Stack Overflow or respective owner

Related posts about android

Related posts about node.js