Search Unity

Question How to get Error Codes from unsuccessful attempt to join a channel

Discussion in 'Vivox (Voice & Text Chat)' started by SvChristian, Oct 24, 2022.

  1. SvChristian

    SvChristian

    Joined:
    Oct 7, 2022
    Posts:
    8
    Hello everyone,

    I am currently working on the handling of large channels according to the documentation. https://support.unity.com/hc/en-us/...Monitor-channel-size-for-large-scale-channels

    As the doc recommends, we would like to catch the VxXmppServerErrorServiceUnavailable (20502) for the case a channel is full for proper error handling. Unfortunately, we do not receive any exception, although the channel has 200 participants already. The ChannelState switches to Connecting and then to Disconnected right away, but no error is thrown anywhere.

    We follow the basic implementation of the channel join according to the documentation;

    Code (CSharp):
    1.     // Connect to channel
    2.     channelSession.BeginConnect(true, true, true, channelSession.GetConnectToken(), ar =>
    3.     {
    4.         try
    5.         {
    6.             channelSession.EndConnect(ar);
    7.         }
    8.         catch (Exception e)
    9.         {
    10.             // Handle error
    11.             return;
    12.         }
    13.  
    14.         // Reaching this point indicates no error occurred, but the user is still not “in the channel” until the AudioState and/or TextState are in ConnectionState.Connected.
    15.     });
    Shouldn't the Error get catched in the try-catch? Or do we have to catch the vivox errors somewhere else?
    Any hint is much appreciated!

    Thanks in advance
    Christian
     
  2. MurphyMurph_21

    MurphyMurph_21

    Joined:
    Jul 3, 2020
    Posts:
    73
    Although you can force an error, or force a user to connect to a channel that is already full the documentation/link you posted seems to suggest that you should check how many Particopants are in channel before joining
    Code (CSharp):
    1. private IChannelSession channelSession;
    2.  
    3. If (channelSession.Participants.Count > 200)
    4. Debug.Log("Channel is full, cannot connect player");
     
    Last edited: Oct 27, 2022
  3. SvChristian

    SvChristian

    Joined:
    Oct 7, 2022
    Posts:
    8
    Thanks for yours Murphy. Unfortunately you can not get the Participants.Count from a channel if it is full already;

    If the channel has less then 200 member, you can retrieve the data in the AsyncResult you get from BeginConnect and decide whether to join or not.

    But if the channel is full already (or you can not join for any other reason) you don't get any result. :-/
    That's why the documentation limits the user count to 100 users when using that method, I assume.

    I think it's a bug that we do not receive any exception at that point. Or the documentation is outdated.
    Would be nice to know which is the case.
     
    MurphyMurph_21 likes this.
  4. MurphyMurph_21

    MurphyMurph_21

    Joined:
    Jul 3, 2020
    Posts:
    73

    Yea no problem I tried lol. I looked at the generated code that talks to C++ core SDK (Assets/Vivox/Runtime/VivoxUnity/generated_files or Packages/com.unity.services.vivox/Runtime/VivoxUnity/swig) and at the ChannelSession code for the Unity SDK (Assets/Vivox/Runtime/VivoxUnity/Private/ChannelSession.cs or Packages/com.unity.services.vivox/Runtime/VivoxUnity/Private/ChannelSession.cs) to see if they were catching specific exceptions but they are not. They are catching normal Exception and displaying the error message and stack trace. I think the VxXmppServerErrorServiceUnavailable is only available in the C++ core SDK or Unreal SDK. We don't have access to that exception in the Unity SDK
     
    Last edited: Nov 10, 2022
    SvChristian likes this.
  5. SvChristian

    SvChristian

    Joined:
    Oct 7, 2022
    Posts:
    8
    Thanks for your investigation Murphy! Although it's very disappointing to hear... :-(
     
    MurphyMurph_21 likes this.