Hi, I'm trying to figure out how to receive an event when the last user exits the room. I noticed I receive an event a few minutes after the last person quits but it doesn't contain anything meaningful to know what the event really is. Is there a way to know what the event is or do I have to connect to the room and compare the status? My goal is to delete the room after everybody has left the room. A few minutes delay is ok. Also, I would like to be able to fetch the chat content before deleting the room; is that information still available when the event is received?
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi
Are you using the RTCHOOKS.java to receive events? if so, there are 6 methods each of them associated with event type, e.g. receiveNode, receiveNodeDeletion, receiveItem, receiveItemRetraction, receiveNodeConfiguration, and receiveUserRole) each method will take collectionName, roomName as parameters, you should be able to get the type of the event.
So for room closing, you should be getting "receiveItemRetraction" on RoomManager collection and roomState node, you should be able to explore the item object which is a java map object to see item details
If you haven't get the RTCHOOKS to work correctly, please take a look at our sample code (sampleApps/Server2Server/BlazeDSGateway_Java), I attached the README.txt here for your reference.
thanks
Dean
Views
Replies
Total Likes
What you are probably talking is an event on RoomManager (the room is shutting down).
While you could "listen" to UserManager events and trigger your logic when there are no more users, I would probably suggest you use RoomManager instead. A user could be temporary disconnected and reconnect right away, but you still will get the notification that for a short time there were no users in the room.
That is why we wait for a couple of minutes of inactivity before "shutting down" the room.
For chat messages, you can try to call "fetchItems" when the room shut down, but it may be too late (if the items are session dependents they may get deleted before you call fetchItems). One alternative is to listen to messages on the "chat" node instead and collect them while they are generated. Another alternative is to make the items for "chat" non session dependent, call "fetchItems" when the room ends and then delete the items.
I forgot to mention I'm using a BlazeDS callback hook for server to server communication. I subscribed to the RoomManager collection but the event I receive when the room is shutting down isn't tagged with the event name. How can I tell that this is the correct event and not some other event occurring?
I'll make the chat non session dependent since I'll be deleting the room shortly after anyway.
Thank you!
Views
Replies
Total Likes
Hi there,
Can you give a little more detail on what you're seeing? What does the
event look like?
thanks!
nigel
Views
Replies
Total Likes
Hi
Are you using the RTCHOOKS.java to receive events? if so, there are 6 methods each of them associated with event type, e.g. receiveNode, receiveNodeDeletion, receiveItem, receiveItemRetraction, receiveNodeConfiguration, and receiveUserRole) each method will take collectionName, roomName as parameters, you should be able to get the type of the event.
So for room closing, you should be getting "receiveItemRetraction" on RoomManager collection and roomState node, you should be able to explore the item object which is a java map object to see item details
If you haven't get the RTCHOOKS to work correctly, please take a look at our sample code (sampleApps/Server2Server/BlazeDSGateway_Java), I attached the README.txt here for your reference.
thanks
Dean
Views
Replies
Total Likes
Hi Nigel, Hi Dean,
Thanks for the quick reply! I'm using the RTCHOOK.java example and added a loop to show the object map.
Here is the result I get a few minutes after the last person left the room (Room name: p001bz1sx4lb07ctyrfd2):
15:58:21,442 INFO [STDOUT] LCCS -- receiveItemRetraction: [my token here] p001bz1sx4lb07ctyrfd2 RoomManager roomState
15:58:21,442 INFO [STDOUT] item map (publisherID) - __server__
15:58:21,442 INFO [STDOUT] item map (body) - active
15:58:21,442 INFO [STDOUT] item map (itemID) - item
15:58:21,443 INFO [STDOUT] item map (timeStamp) - 1.187719119485E12
15:58:21,443 INFO [STDOUT] item map (associatedUserID) - __server__
15:58:21,443 INFO [STDOUT] item map (nodeName) - roomState
15:58:21,443 INFO [STDOUT] item map (collectionName) - RoomManager
So, if I understand correctly, if I get the event receiveItemRetraction from RoomManager on the node roomState, that means the room is shutting down. Is this the correct way to do it?
Thanks,
Kaven
Views
Replies
Total Likes
Yes, this indicates that the room is just about to close (again, a couple of minutes after the last user has left)
Sent from my iPad
Views
Likes
Replies
Views
Likes
Replies