deepstream.io-client-java icon indicating copy to clipboard operation
deepstream.io-client-java copied to clipboard

App crashes on connection change using deepstream

Open DevRahulChokshi opened this issue 7 years ago • 0 comments

While I'm changing connection, my app crashes and shows the following stack trace:

E/AndroidRuntime: FATAL EXCEPTION: Timer-3
    Process: com.app.teemchat, PID: 9383
    io.deepstream.DeepstreamException: CONNECTION_ERROR: null
        at io.deepstream.DeepstreamClientAbstract.onError(DeepstreamClientAbstract.java:59)
        at io.deepstream.Connection$1.run(Connection.java:187)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

client.addConnectionChangeListener(new ConnectionStateListener() {
    @Override
    public void connectionStateChanged(ConnectionState connectionState) throws RuntimeException {
        Log.w(Tag, "ConnectionChange>>> " + connectionState.toString());
        if (connectionState.toString().equalsIgnoreCase(ConnectionState.ERROR.toString())) {
           client.close();
           doLogin();
           }

           if (connectionState.toString().equalsIgnoreCase(ConnectionState.CLOSED.toString())) {
              doLogin();
              }
        }
});

DevRahulChokshi avatar Sep 03 '18 07:09 DevRahulChokshi