TokBox number of users in a room or session - ruby-on-rails

I am new to using TokBox with my Rails app. I have created my "rooms" and a user can create a "room" and other users can join the room and video conference together Marvelous! But how do I know how many users are in a room and which users they are? I would like to display their information eventually but initially I just need to know how to see who is in the room on pageload. Any experienced TokBox devs out there?

There isn't any way to see who is in the room on pageload. Once you are connected to a session, you will get a connectionCreated event for every person in the room. To get the number of users in the room, just have a counter that increments for each connectionCreated event that gets triggered.

Related

Twilio iOS sdk - one to one video calls

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.

How can I implement auto join for XMPP room in iOS

I want to do Auto Join room in XMPP group chat.
I have all of group created from back end Server, first time i join the room but when i disconnect from XMPP (out of the app) and back inside app and re-connect xmpp, I again need to join the room.
In side app one user already available in multiple room so not possible to Join again n again in the room . Please help..
Thanks in Advance!
I think you have to show this link : https://xmpp.org/extensions/xep-0048.html .
Here you can find the solution of Auto join and room storage.
There is No way for , reEnter to your rooms Automatically.
you should make a loop in your group list ( rooms ) and Enter to each of them.
i recommend to do it by operationQueue.

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.

iOS: can game center account somehow be used for authentication on custom webservice?

Let's say we wan to have a custom backend for a iOS game that manages user accounts and allows the users to send objects to each other, but we don't want to actually have the user to create a dedicated useraccount for our game. It would be possible to simply use the playerID for the usermanagement, but that would not be secure. Is there any way to use a local gamecenter authentication to also authenticate at a custom webservice?
Currently i ponder about how the game 'pocket frogs' enables the players to send gifts to gamecenter friends. Gamecenter doesn't seem to provide this functionality so i assume they use a custom backend for it, but how can such a backend authenticate the player?
I can't say for sure if this is how Pocket Frogs (PF) does it, but based on the fact that only Game Center (GC) friends who also play PF appear on the neighbours list, I think it may work like this:
When a player first starts the game, they get a user id (a 32-bit int, say) from the PF back end which is stored locally. Once the player has this id it can be stored in one of the GC leaderboards under the GKScore context property rather than the value. As far as I can see, PF automatically adds every player to all of the leaderboards pretty much straight away.
Then when another player wants to send a gift, PF gets the leaderboard scores for all of their GC friends and if they have a valid score they must be a PF player and the context value can be read to get their PF id.
In this way the PF back end gets the correct id, but doesn't need to use their GC id.
Incidentally, I tried out the idea of using challenges for sending gifts, and it can work. See http://www.lrgdigital.com/ofgame.html for the game I tried it with - you have to win a game before you can gift it. It has the benefit that you can send the gift to anyone on your friends list rather than only friends who play the game, but there are some limitations as well.
No. Gamecenter uses apple id and that is off limits for obvious reasons. And if you look into the game center framework, there is a way to get gamecenter friends.
Look here to see how to get an array of friends: Game Center Friend List

Keep track of read/unread User Messages with a MessageClicks table?

I'm trying to implement a simple Inbox system for users of my app so that can send basic messages to each other - just like in many forum systems.
If User has_many :messages, how do I keep track of and notify the User of messages unread since last time they were read?
I'm thinking clicks on the link to the Messages screen need to be recorded in a separate table (MessagesClicks).
Is that the best approach here?
So then I check the MessagesClicks table to see if any new messages have arrived since the last time that link was clicked - based on a last_clicked or updated_at field.
I would keep track of when a message was read on the message itself with the default value of null.
If the user has any Messages with a dateRead value of null then they have unread messages.
When you display a message to the user on the Messages screen, update the dateRead property of the message from null to now.

Resources