Returning -1 if no message was sent

develop
Nelson R. Perez 2018-06-14 00:02:10 -05:00
parent 7c84187681
commit 3159a44c3a
1 changed files with 4 additions and 4 deletions

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,10 +159,9 @@ 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 mCurrentId;
return -1;
}
/**