updatePresence Behaviour of setRoomOccupantListener

54 views
Skip to first unread message

Matthias Döring

unread,
Jun 24, 2015, 1:56:44 AM6/24/15
to eas...@googlegroups.com
Hello,

I use setRoomApiField to assign a clear text name to an easyrtc id. I cannot use setUsername because the name is just available
after I call easyrtc.connect(). That works as expected and I can use the name as an alias for the easyrtc id.

Now I found a problem when calling updatePresence. I use that to signal to the other peers of a room that a certain peer is busy.
If I call updatePresence that triggers the RoomOccupantListener as expected. The problem is that now the apiField Object is
not longer contained in the peer data for the peer which called the updatePresence function. The presence status which was set
by that peer is contained but not the apiField. With that I do not have the name which I assigned to that peer which is needed as
a primary key for a database lookup.

All other peers which are signaled in the RoomOccupantListener still have the apiField.

That behaviour happens just ones - for the very first broadcast of the room occupants. If I disconnect another peer and reconnect it
it gets all other peers with both information parts - the actual presence state AND the apiField.


Is that intented behavior? What can I do to achieve both goals - having apiFields assigned to an easyrtc ID and dynamic presence
information?


Thank you

Matthias Döring

unread,
Jun 24, 2015, 2:45:09 AM6/24/15
to eas...@googlegroups.com
I tested the following as an alternative:

- when adding a new apiField with setRoomApiField that causes as well that the RoomOccupant Listener of the other peers gets called
- would it be the right way to use an apiField instead of the updatePresence function to get what I want?
- what is actually the difference between the presence object in a peer and the apiFields object? Would it be recommended to use apiFields
as a replacement for the presence information?

Would be nice if you could bring me to the right way.


Regards

Eric Davies

unread,
Jun 25, 2015, 1:30:33 AM6/25/15
to eas...@googlegroups.com
It was a bug you have the honour of having been the first to exercise.
I've put a fix into the beta branch. If you switch to that branch, you should find it working correctly now.

Matthias Döring

unread,
Jun 27, 2015, 6:30:24 AM6/27/15
to eas...@googlegroups.com
Hello again,

I tested now beta 1.0.13 from Git. Unfortunately now I have another problem with the ApiFields which I did not have in the non beta branch.
The original problem seems to be solved but now I see the following thing:

If a client calls easyrtc.connect the RoomOccupant Listeners of the other clients in the same room get called as expected. But now there
is no apiField for that client available at all. My sequence for starting the client is:

connect() - onSuccessHandler ->joinRoom(new room) - onSuccessHandler -> leaveRoom(old room) - onSuccessHandler ->setRoomApiField

Neither my custom apiField information nor the normally always contained field mediaIds reaches the occupant listeners of the other clients.


I do not call initMediaSource in the sequence above. Maybe something changed in the beta version when you do not have a stream intialized.
But in the 1.0.13 that did not matter. You always got the apiField. 


Currently I do not have a reliable way to signal client states to the other clients of a room. The presence info is always in the notification.
Could I simply use its "status" field to send a JSON object with my custom information?



Eric Davies

unread,
Jun 28, 2015, 12:52:59 AM6/28/15
to eas...@googlegroups.com
I had a typo in a conditional, I was looking for "roomApiField" instead of "apiField" in the message from the server.
It should be fixed now (which is to say, I could reproduce the problem before the fix, but not afterwards).

Reply all
Reply to author
Forward
0 new messages