I am new to using the Xirsys API for Android. I have followed the tutorial ("Learning WebRTC Getting Started"), but one thing I am noticing is that the 'users' message I get from SYS keeps growing, with duplicates of the same name I am using for my tests (presumably because I am connecting multiple times as I am trying out the APIs). Here is an example message:
{"m":{"f":"StayingInTouch/__sys__","o":"peers","t":null},"p":{"users":["tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad@gmail.com","tad"]},"t":"u"}
Is there something I am supposed to do other than close the various resources in order to have Xirsys remove that user from its internal list?
I start by issuing a PUT via Volley to get the token, then follow that up with a GET via Volley to get the signalling host Url, then open the socket:
okhttp3.Request request = new okhttp3.Request.Builder().url(hostValue + "/v2/" + mToken).build();
ws = client.newWebSocket(request, socketListener);
All that works just fine, and I am able to signal back and forth.
Here is my onDestroy():
protected void onDestroy() {
shutDownResources();
try {
client.dispatcher().executorService().shutdown();
} catch (Exception e) {
myLog("Error shutting down socket client: " + e.getMessage());
}
mQueue.cancelAll(null);
mQueue.stop();
super.onDestroy();
}
And here is the shutDownResources() method:
private void shutDownResources() {
if ( localDataChannel != null ) {
try {
localDataChannel.unregisterObserver();
localObserver = null;
localDataChannel.close();
localDataChannel.dispose();
localDataChannel = null;
} catch (Exception e) {
myLog( "Error closing local data channel:" + e.getMessage());
}
}
if ( localPeer != null ) {
try {
localPeer.close();
localPeer.dispose();
localPeer = null;
} catch (Exception e) {
myLog( "Error closing peer:" + e.getMessage());
}
}
if ( ws != null ) {
try {
ws.cancel();
ws = null;
} catch (Exception e) {
myLog( "Error shutting down socket client: " + e.getMessage());
}
}
iceServers = null;
iceServerMap.clear();
}