Expose error messages where NS connection fails
This commit is contained in:
parent
7b0ea23b40
commit
43495e2565
1 changed files with 10 additions and 0 deletions
|
@ -283,6 +283,9 @@ public class NSClientService extends Service {
|
||||||
mSocket = IO.socket(nsURL, opt);
|
mSocket = IO.socket(nsURL, opt);
|
||||||
mSocket.on(Socket.EVENT_CONNECT, onConnect);
|
mSocket.on(Socket.EVENT_CONNECT, onConnect);
|
||||||
mSocket.on(Socket.EVENT_DISCONNECT, onDisconnect);
|
mSocket.on(Socket.EVENT_DISCONNECT, onDisconnect);
|
||||||
|
mSocket.on(Socket.EVENT_ERROR, onError);
|
||||||
|
mSocket.on(Socket.EVENT_CONNECT_ERROR, onError);
|
||||||
|
mSocket.on(Socket.EVENT_CONNECT_TIMEOUT, onError);
|
||||||
mSocket.on(Socket.EVENT_PING, onPing);
|
mSocket.on(Socket.EVENT_PING, onPing);
|
||||||
RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "do connect"));
|
RxBus.INSTANCE.send(new EventNSClientNewLog("NSCLIENT", "do connect"));
|
||||||
mSocket.connect();
|
mSocket.connect();
|
||||||
|
@ -395,6 +398,13 @@ public class NSClientService extends Service {
|
||||||
nsDevice = SP.getString("careportal_enteredby", "");
|
nsDevice = SP.getString("careportal_enteredby", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Emitter.Listener onError = new Emitter.Listener() {
|
||||||
|
@Override
|
||||||
|
public void call(final Object... args) {
|
||||||
|
RxBus.INSTANCE.send(new EventNSClientNewLog("ERROR", args[0].toString()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private Emitter.Listener onPing = new Emitter.Listener() {
|
private Emitter.Listener onPing = new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(final Object... args) {
|
public void call(final Object... args) {
|
||||||
|
|
Loading…
Reference in a new issue