Until then, your app will need to handle connection states outside of the SDK. Using a group channel with the Chat SDK could be one workaround solution for this.
Connection status will only tell you if they are online or not. It will not tell you if they are in a call or not. However, you can use the Chat SDK to update user metadata (for example: in_call:true/false) and update it when a call begins/ends. The other users can lookup the user’s metadata before they try to call to know if they are in a call or not.
The updated user data will continue to be retrievable via the sb. object. The other user metadata is entirely defined by the dictionary you create during the user.createMetaData() step.
As an alternative, you could create a single group channel for your app that contains all the users that are currently in a call. Invoke groupChannel.join() when a call starts, invoke groupChannel.leave() when a call ends, and use groupChannel.members to get the list of who is currently in a call. With this you can check if the user you are calling is in a call.
for the first user enter the call then
var user = sb.user;
//init
user.createMetaData({in_call:false}, …);
//start call
user.updateMetaData({in_call:true}, …);
Now this time the second user user 2 tries to call user 1
if the user2 loges in and tries this
var user = sb.currentUser;
var value1 = user.metaData['in_call'];
he get his metadata not the user1 metadata.
how the user2 will get the user1 metadata
////if there any method like this
var user2=sb.getuserbyid(user1);
then get user2 metadata ?
Oh, I see what you mean now. To find user2, you will need to use the group channel as described above. groupChannel.members will return the user objects of others in the group, from which you can retrieve metadata. User2 will first have to join the group when the call starts. Then user1 can check if user2 is in there.
Yes that is the Chat SDK object. The createMetaData method is only available on the currentUser object—can you verify that is the object you are trying to call the method from?
That should work. Can you set a debugger in the code right after console.log(user). Then from the dev tools console, type user. (include the dot) and check what functions are available.