voximplant / react-native-voximplant

Voximplant mobile SDK for React Native (iOS/Android)
http://voximplant.com
205 stars 39 forks source link

Clarity on the login time period and best practices to keep a user logged in #64

Closed sanjaypojo closed 5 years ago

sanjaypojo commented 5 years ago

We're currently using voximplant successfully, but one issue we encounter is keeping a user logged in. There are times when a call is made and we get the "user_offline" error, even though the user is signed in or attempting to sign in.

We want to make receiving calls more reliable. Here are some questions we had:

Thanks in advance!

sanjaypojo commented 5 years ago

Hi @YuliaGrigorieva, could you please advise about this? We are facing issues where the user does not receive incoming calls as they are logged out automatically by voximplant.

YuliaGrigorieva commented 5 years ago

Hello!

Please find my notes below:

Is there an easy / fast way to check if a user is logged into voximplant (without a server side look up)?

Yes, you can use Client.getClientState API: https://voximplant.com/docs/references/reactnative/voximplant/client#getclientstate

Is there a way to make the login persist for a longer time?

What do you mean for "a longer time"? Once the client is logged in, logged in state depends on:

How long does voximplant wait before logging a user out?

Voximplant SDK does not have any internal logic to log out the user itself. If the connection to the Voximplant Cloud is lost, the Client.ConnectionClosed event will be invoked.

Is there a logout event that we can respond to and renew the login?

We do not have special "log out" event, you need to handle Client.ConnectionClosed event that will inform you that the client in no more connected to the Voximplant Cloud and the user is logged out.


We also highly recommend to use push notifications and handle them in any client state. They will allow not to keep the connection to the Voximplant Cloud all the time, but establish only when required depending on the application logic.

Please let me know if you have any questions.

Best regards, Yulia Grigorieva

sanjaypojo commented 5 years ago

Hi Yulia, thanks for the detailed response. Just to clarify, all my questions are related to peer-to-peer calls.

We've noticed that on ios, our users often fail to connect on a call and the issue reported in vox is "user offline", even though the user never left the app. We believe that this is because the connection to Vox is dropped after some period of time.

During a peer-to-peer call, how long does voximplant try to establish a connection? Will vox wait for 2-5 seconds for the other user to come online? If not, what is the best way to handle this?

YuliaGrigorieva commented 5 years ago

Hello!

"User offline" call failure reason in the call session logs generally means that the user was not logged in when another user called him.

As far as I understand, your issue is related to the case when the connection to the Voximplant Cloud is dropped just before the call, so the user (callee) does not receive the incoming call.

Let me describe how the Voximplant Cloud behaves if the user (callee) is offline:

  1. you don't use push notifications. In this case the call session will be instantly closed in the Voximplant Cloud and the caller client will receive CallEvents.Failed with the code 480 - Temporary Unavailable. In the call session logs you will see error 480 - User offline
  2. you use push notifications. In this case the Voximplant Cloud waits 20 seconds for the user (callee) to log in. After the user (callee) is logged in within this time interval, the Voximplant Cloud waits 60 seconds for the user to answer/decline the call.

You can also contact us at support@voximplant.com and provide the Voximplant SDK logs to investigate why the connection to the Voximplant Cloud is closed ( is this some SDK/SDK usage issue or iOS drops the connection itself).

Best regards, Yulia Grigorieva

sanjaypojo commented 5 years ago

Hi Yulia, that makes sense! We would love to use push notifications to circumvent this issue. Is there any documentation on how we use peer-to-peer calls with push notifications?

YuliaGrigorieva commented 5 years ago

Hello!

Please take a look at these articles for android and ios push notification setup:

You can also use the demo project as a reference for js code.

Let me know if you face any issues or have any questions.

Best regards, Yulia Grigorieva

YuliaGrigorieva commented 5 years ago

Closing this issue, it seems there are no more questions related to login state for now.

If you have any questions or face any issues, please open a new issue.

Best regards, Yulia Grigorieva