Twilio iOS sdk - one to one video calls - twilio

I'm trying to achieve one to one video calls using Twilio video service. I already configure my server side for generating tokens. So, what should I do now?
Do I need to create room for each user on app start and then join this room with another user? Or it should be some specific room (combination of user1 data + user2 data), if so - when user2 joins this room how should I handle room notifications on user1 side?

For one to one user call I would suggest every user might have unique username or anything which is unique ,so you can build up logic for room name like username1-username2 , and whenever username1 tries to call username2 we can set up logic on backend in a way that will generate token of specific room only.
On receiver end username2 can receive VoIP or remote notification and this notification user data (payload) should contain room name to be joined so that when username2 receives call or notification, we can make request for joining in same room in which username1 already exist.

Related

Ban a user: how to kick him out of the chat room (trigger a client side event)

I have a chat app which is connected to Firebase / Firestore and utilizes Firebaseanimatedlist in conjunction with the realtime database. When an admin of a group bans a user, I save his userid and restrict his access to the chat room. But consider that the user is currently in the chat room when he is banned. So how do I trigger an event client side when the userid is now saved within an array (list) in Firebase to kick him out of the chat room is is currently in?
Is FCM an option?
Presuming that you are using the realtime aspect you can check the database whenever it is updated and if the user exists in the database either hide the content or leave the chat.

XMPP Get number of room members without connecting to a room

I have: ios app;
Server: openfire;
Framework: xmppframework from Robby Hanson.
The logic of the app is when user has logged in, the app will push him into a random room which has the fewest number of members.
The app successfully gets a list of all rooms on start from the server.
But I need to know which of these rooms have an empty place for a user!
There is a method called "fetchmemberslist", but it only returns you a list of members of a room when you are connected to that room.
I need something that will do the same without connecting to a room.
Think if I have 1000 rooms. Using this method the app needs to connect to every room, set delegate, activate, wait for IQ, remove delegate, deactivate and at the and go thru an array to find one with the fewest members.
Isn't it too much to do?
I have dig over the whole internet and everything leads to getting a member list when you are connected to a room.
Is there a way of doing this without connecting a room.
Many thanks in advance!
1) fetchMemberList: queries room members, not list of people who are present in room now. Are you really want members, not online users count? Anyway, if you are room admin, this query works without joining room.
2) If you want to query online users, you should use different query - see http://xmpp.org/extensions/xep-0045.html#disco-roomitems
3) Also, no one can forbid you to implement room members/onlines count on the server side and create custom query like <iq id='123' type='get'><freeroom xmlns='my:freeroom:query' /></iq> with response of room JID like <iq id='123' type='result'><freeroom xmlns='my:freeroom:query'><jid>roomname#conference.example.com</jid></freeroom></iq> where roomname was found by server itself.

QuickBlox Chat: How to detect that another user has disconnected?

I am implementing a chat application for iOS. Here is the scenario:
Two QBUUsers engaged in an active exchange of chat messages.
User1 goes offline for some reason (disconnects or app goes to background). Lets assume that the app called logout on the QBChat instance.
User2 sends a ChatMessage to User1 because he thinks User1 is still online.
I should send a Push Notification to User1 instead, but how do I detect that User1 is no longer available to receive a ChatMessage?
I saw that on StackOverflow someone recommended checking the "last_request_at" property on a QBUUser, but that seems heavy-handed since I have to query the server every time I send a ChatMessage. Also that will not tell me when they logged out of the QBChat instance.
My fallback plan is to track user login/logout on our own app server (not rely on QuickBlox server). Any elegant solution here using the QuickBlox SDK?
You have 2 ways what to do:
1) Use contact list http://quickblox.com/developers/SimpleSample-chat_users-ios#Contact_list
With contact list you can track online status of user for your contact list. Contact list is similar to common friends list like in Facebook.
2) send Push Notifications for every message. If user is offline - he will receive it. If user is online - just ignore this push.

Quickblox: Share 1.Image and 2.Video along with text chat among users

I am able to establish 1-1 chat by creating a room. I have used room because I will get history of last 50 messages (I would prefer more in number with paged results and expecting this feature in the near future).
I am unable to figure out how I can implement image and video sharing in between the text chat.
I also want this in the history I get. I mean I need to get the order of the text/image/video along with their details to display to the user.
When I upload an image file using Content module, the files are saved in a separate table in contents section (which is fine for user's gallery kind of app). But for chat we need to know who sent to whom and what (image/video/text).
I would like to know whether this is possible with the current version of the Quickblox sdk. or else is there any way we can establish this using Custom objects module? If possible, will this work if there are more number of users in the room? Please give me a solution to this.
If you want create chat with content, you need to use a Custom Objects. (in current QB version).
Advantage - you can also get chat history and implement deleting of message history.
But this method doesn't very simply.
At first you need create Custom objects represented next things:
single chat message
group chat message
(may be need create extended user profile)
At first, you can use QBChat module for changing service information between users.
When you need send message, you create Custom Object (CO) - message with parameters and upload it. When it uploading, you send service message via QB chat to your opponent user. When opponent will receive it, he should perform request for updating CO (in this case - single message).
As example, single chat message can contain next parameters:
opponent qb user id;
owner qb user id;
message text;
link to content;
Sending of content message divide to next steps:
At first, you need upload content file using Content module, and after this create message CO, upload it on server and send service message to your opponent

Process Subscription on Roster has got messed after new attribute has been added Ejabbered

I have a problem in the subscription process after adding a new attribute to the mod_roster_odbc.erl
This obviously required me to alter the table rosterusers adding a new column for the record as well as the queries get_roster (s) in the odbc_queries for this module. And then in the module mod_roster_odbc, I had to extend methods like process_iq (get and set(s)) methods and others like, record_to_string, raw_to_record, process_item_attrs, and also get_subscription_lists, and pending queries for the new attribute to be initialised when setting each element of the roster
I have tested my change to the point of setting each element of my roster and save it correctly to DB, the same goes for getting to roster and the new attribute/record is added just like expected.
Now, my problem is that I broke the subscription part in the client side. The client logic subscribes to each element of the roster, before this changed I was able to subscribe automatically between two contacts being online. As far as I understand, user A sets user B in its roster and subscribes and then server sends presence to user B with this request so that user B subscribes back to user A and user finally get them subscribed as "Both". This is not happening after my change in the server.
Currently, user A is able to set user B to its roster but it does appear offline and I can see that subscription is "None" from rosterusers, basically one has the other on the roster but they do not manage to be subscribed or see each other online. Just until user A sends a message to user B subscription get processed and Both are subscribed to each other.
Now, I would like to avoid providing my code changes because I do ask for hints to know where I might have broken this logic in the server side. What would be the part of the presence that got broken with so small change....

Resources