I have initialized the socket and set the reconnection strategy as follows
socket.setReconnection(new ReconnectStrategy());
Now, if I call socket.disconnect() when connection is active, then there is no issue. But if I call the disconnect() method when the connection was broken and reconnection loop is triggered the app is crashing with NullPointerException in reconnect() method.
As I understand the scenario, as soon as connection to the server is broken it initiates a reconnection loop. There is a null check before calling the reconnect() method but no check in the TimerTask. If the disconnect() method is called on the socket object , it will set the strategy to null and when the TimerTask is executed after scheduled time, it is crashing with NullPointerException
I have forked the repo, added a null check in the TimerTask. It is now working without crashing.
I have initialized the socket and set the reconnection strategy as follows
socket.setReconnection(new ReconnectStrategy());
Now, if I callsocket.disconnect()
when connection is active, then there is no issue. But if I call thedisconnect()
method when the connection was broken and reconnection loop is triggered the app is crashing withNullPointerException
inreconnect()
method.As I understand the scenario, as soon as connection to the server is broken it initiates a reconnection loop. There is a null check before calling the
reconnect()
method but no check in theTimerTask
. If thedisconnect()
method is called on thesocket
object , it will set thestrategy
to null and when theTimerTask
is executed after scheduled time, it is crashing withNullPointerException
I have forked the repo, added a null check in the
TimerTask
. It is now working without crashing.