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))
|
||||
|
||||
@@ -86,6 +86,7 @@ const (
|
||||
WebsocketEventAcknowledgementRemoved WebsocketEventType = "post_acknowledgement_removed"
|
||||
WebsocketEventPersistentNotificationTriggered WebsocketEventType = "persistent_notification_triggered"
|
||||
WebsocketEventHostedCustomerSignupProgressUpdated WebsocketEventType = "hosted_customer_signup_progress_updated"
|
||||
WebsocketPresenceIndicator WebsocketEventType = "presence"
|
||||
)
|
||||
|
||||
type WebSocketMessage interface {
|
||||
|
||||
Ссылка в новой задаче
Block a user