Returning -1 if no message was sent

This commit is contained in:
Nelson R. Perez 2018-06-14 00:02:10 -05:00
parent 7c84187681
commit 3159a44c3a

View file

@ -142,11 +142,12 @@ public class NetworkService extends Service {
if(mWebSocket != null){
if(mWebSocket.send(message)){
Log.v(TAG,"-> " + message);
return mCurrentId;
}
}else{
throw new RuntimeException("Websocket connection has not yet been established");
}
return mCurrentId;
return -1;
}
public long sendMessage(ApiCallable apiCallable, int requiredApi){
@ -158,11 +159,10 @@ public class NetworkService extends Service {
mRequestClassMap.put(mCurrentId, apiCallable.getClass());
if(mWebSocket != null && mWebSocket.send(call.toJsonString())){
Log.v(TAG,"-> "+call.toJsonString());
}else{
return -1;
}
return mCurrentId;
}
return -1;
}
/**
* Method used to inform any external party a clue about the current connectivity status