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
@@ -105,13 +105,15 @@ type WebConn struct {
|
||||
// a reused connection.
|
||||
// It's theoretically possible for this number to wrap around. But we
|
||||
// leave that as an edge-case.
|
||||
reuseCount int
|
||||
sessionToken atomic.Value
|
||||
session atomic.Pointer[model.Session]
|
||||
connectionID atomic.Value
|
||||
endWritePump chan struct{}
|
||||
pumpFinished chan struct{}
|
||||
pluginPosted chan pluginWSPostedHook
|
||||
reuseCount int
|
||||
sessionToken atomic.Value
|
||||
session atomic.Pointer[model.Session]
|
||||
connectionID atomic.Value
|
||||
activeChannelID atomic.Value
|
||||
activeTeamID atomic.Value
|
||||
endWritePump chan struct{}
|
||||
pumpFinished chan struct{}
|
||||
pluginPosted chan pluginWSPostedHook
|
||||
|
||||
// These counters are to suppress spammy websocket.slow
|
||||
// and websocket.full logs which happen continuously, if they
|
||||
@@ -290,6 +292,26 @@ func (wc *WebConn) GetConnectionID() string {
|
||||
return wc.connectionID.Load().(string)
|
||||
}
|
||||
|
||||
// SetActiveChannelID sets the active channel id of the connection.
|
||||
func (wc *WebConn) SetActiveChannelID(id string) {
|
||||
wc.activeChannelID.Store(id)
|
||||
}
|
||||
|
||||
// GetActiveChannelID returns the active channel id of the connection.
|
||||
func (wc *WebConn) GetActiveChannelID() string {
|
||||
return wc.activeChannelID.Load().(string)
|
||||
}
|
||||
|
||||
// SetActiveTeamID sets the active team id of the connection.
|
||||
func (wc *WebConn) SetActiveTeamID(id string) {
|
||||
wc.activeTeamID.Store(id)
|
||||
}
|
||||
|
||||
// GetActiveTeamID returns the active team id of the connection.
|
||||
func (wc *WebConn) GetActiveTeamID() string {
|
||||
return wc.activeTeamID.Load().(string)
|
||||
}
|
||||
|
||||
// areAllInactive returns whether all of the connections
|
||||
// are inactive or not.
|
||||
func areAllInactive(conns []*WebConn) bool {
|
||||
|
||||
Ссылка в новой задаче
Block a user