Page: unichat system messages
2019-11-21 11:11
Unichat system messages
In some cases the service post special messages to clients that, most often
require special reating on clients. For compatibility reasons all of them
have text
set to some english explanation, but client software must interpret
it an synthesize proper text and diplay style accorging to each message type.
Message type is passed in xtag
parameter which is always non-null on system
messages. Extra data about referenced object could be passed in referece
field.
Room creation (xtag: create)
This message is sent on behalf of room creator and is always the first message in a room.
Client software should display specially styled message with localized text like "$name$ has created the room"
New user invited (xtag: invite)
Is sent on behalf of the user who just invited some other user. The reference
field will be:
{ reference: { type: "user", id: <new_user_id> } }
Client software should display specially styled message with localized text like "$message.user.name$ has invited #{message.reference.user.name} to this chat". By this time the new created user will appear in the updated subscription that could be reloaded if need.
New user joined (xtag: joined)
It is send when user enters a group by self, e.g. with an invite code. It is not sent when the user in invited to a group. The client should localize and format it in a different way from regular messages.
See unichat API administration and unichat invite codes for details.
User has left the room (xtag: leave)
Is sent on from the user leaving the group. Client software should properly localize it and show user name. It should be visually different from usual messages.
Admin kicked out user (xtag: kick_out)
Is send when admin is kicking somebody out of the room. Client software should
localize it and show it visually different from usual messages. The message
is sent from the admin and has reference
set to user being kicked out.