0

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();
}
tfrysinger
  • 1,306
  • 11
  • 26
  • Hi, I am facing the same issue with duplicate users in peers list , did you manage to find a solution ? – jacob Mar 30 '20 at 22:03
  • @jacob - yeah, I switched to using PubNub APIs at the recommendation of XirSys support :) – tfrysinger Mar 31 '20 at 02:35
  • This is a bug in their system? – jacob Mar 31 '20 at 08:10
  • I think it is. I got the distinct impression that this capability was somewhat new and not fully baked, and more to the point - not something they consider their core competency. Maybe I'm reading too much into our chat exchange, but that was the impression I was left with. – tfrysinger Mar 31 '20 at 14:08

0 Answers0