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 ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f35b0a3781
Коммит
e0b5b951f1
@@ -326,6 +326,22 @@ func (wsc *WebSocketClient) GetStatusesByIds(userIds []string) {
|
||||
wsc.SendMessage("get_statuses_by_ids", data)
|
||||
}
|
||||
|
||||
// UpdateActiveChannel sets the current channel that the user is viewing.
|
||||
func (wsc *WebSocketClient) UpdateActiveChannel(channelID string) {
|
||||
data := map[string]any{
|
||||
"channel_id": channelID,
|
||||
}
|
||||
wsc.SendMessage(string(WebsocketPresenceIndicator), data)
|
||||
}
|
||||
|
||||
// UpdateActiveTeam sets the current team that the user is in.
|
||||
func (wsc *WebSocketClient) UpdateActiveTeam(teamID string) {
|
||||
data := map[string]any{
|
||||
"team_id": teamID,
|
||||
}
|
||||
wsc.SendMessage(string(WebsocketPresenceIndicator), data)
|
||||
}
|
||||
|
||||
func (wsc *WebSocketClient) configurePingHandling() {
|
||||
wsc.Conn.SetPingHandler(wsc.pingHandler)
|
||||
wsc.pingTimeoutTimer = time.NewTimer(time.Second * (60 + PingTimeoutBufferSeconds))
|
||||
|
||||
Ссылка в новой задаче
Block a user