Federated typing indicators with same userId
Since it's not directly related to federated calls, I thought creating a new issue makes the most sense.
While testing https://github.com/nextcloud/spreed/pull/12604 I was unable to get typing indicators to work at first. For my testing I used the same userId on both servers, so I basically had 2 admins in my conversation:
Since we suppress typing indicators for ourselves, the federated indicator did not show up, but the signaling messages from that user were received fine.
Purely from the signaling message, I don't see a way to distinguish if it's "my" userId or a federated one:
{
"type": "message",
"message": {
"sender": {
"type": "session",
"sessionid": "Tco...",
"userid": "admin"
},
"data": {
"type": "startedTyping",
"to": "2fJ7u..."
}
}
}
You should rely on the sessionid in the sender to find out who sent a message. If it's your own (as received in the hello response), you sent the message, otherwise it's somebody else. You receive the other session ids in the join events.
Yes, but if I have a session on web and one on iOS, currently when I type on web, I don’t show myself as typing in iOS. But this is not possible with the session id ?
Besides, message are never sent back to the own session: https://github.com/strukturag/nextcloud-spreed-signaling/blob/1d68bdd8df7e826102217db3a278abcbd0b7804e/hub.go#L1729-L1732
Yes, but if I have a session on web and one on iOS, currently when I type on web, I don’t show myself as typing in iOS. But this is not possible with the session id ?
Oh, I see, that's right.
So what I could do is add a flag in the join event for the federated sessions, so you can differentiate from there, e.g. save the entries from the join events, use the sessionid from the typing indicator to lookup the entry and check the (tbd) federated flag. Would that solve your issue?
Yes, having a federated would solve it. Then we could check userId == myUserId && !federated. But I am wondering if it would be easier to just add the federated flag to the typing message itself? Either on the signaling server or by the client, as the client also knows that it’s a federated room.
We might need the information for other parts in the future, too. Also I would rather have it only once in the join event than including it in every typing message.
Just to be sure (I don't know right now on the top of my head), when I join a room where participants are already there, do I still receive a join for those that are already part of the conversation? And there's no chance that a typing message would be received before I receive a join message, right? I guess then it would work as well and we can just map the session.
You will receive join events for all sessions already in the room. As they are sent asynchronously (especially in clustered setups), there is a small chance that a typing message could be sent while these join events are being sent.
How do you get the display name to show with the typing status? Don't you use the session id to lookup the entry from the join events already?
Flag added in https://github.com/strukturag/nextcloud-spreed-signaling/pull/776/commits/fc0591b45881a2d230af62ce2a19e64990df31af
How do you get the display name to show with the typing status? Don't you use the session id to lookup the entry from the join events already?
That is a very good point indeed 😂 Yes, then this would be absolutely fine. Thanks!
Speaking of displaynames. It seems that these are missing for federated users? This is a join from a federated user:
This from a user of the instance:
Is there still something to do here? If so for whom? Backend or Frontend/clients?
The flag was added and the handling was implemented on iOS. In theory frontend needs to also handle this, but might not be worth the effort.