MM-56060: Create base scaffolding for websocket pub-sub (#25654)

We create a new websocket action called "presence" which
can contain the active_channel and the active_team for a given
client connection.

On the client side, for every channel or team switch, we send
out this message.

https://mattermost.atlassian.net/browse/MM-56060

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2023-12-12 08:49:09 +05:30
коммит произвёл GitHub
родитель f35b0a3781
Коммит e0b5b951f1
9 изменённых файлов: 120 добавлений и 9 удалений

Просмотреть файл

@@ -355,7 +355,7 @@ export default class WebSocketClient {
}
}
sendMessage(action: string, data: any, responseCallback?: () => void) {
sendMessage(action: string, data: any, responseCallback?: (msg: any) => void) {
const msg = {
action,
seq: this.responseSequence++,
@@ -382,6 +382,20 @@ export default class WebSocketClient {
this.sendMessage('user_typing', data, callback);
}
updateActiveChannel(channelId: string, callback?: (msg: any) => void) {
const data = {
channel_id: channelId,
};
this.sendMessage('presence', data, callback);
}
updateActiveTeam(teamId: string, callback?: (msg: any) => void) {
const data = {
team_id: teamId,
};
this.sendMessage('presence', data, callback);
}
userUpdateActiveStatus(userIsActive: boolean, manual: boolean, callback?: () => void) {
const data = {
user_is_active: userIsActive,