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
@@ -417,8 +417,29 @@ func TestWebSocketStatuses(t *testing.T) {
|
||||
require.True(t, awayHit, "didn't get away event")
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
|
||||
WebSocketClient.Close()
|
||||
func TestWebSocketPresence(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
wsClient, err := th.CreateWebSocketClient()
|
||||
require.NoError(t, err)
|
||||
defer wsClient.Close()
|
||||
wsClient.Listen()
|
||||
|
||||
resp := <-wsClient.ResponseChannel
|
||||
require.Equal(t, resp.Status, model.StatusOk, "should have responded OK to authentication challenge")
|
||||
|
||||
wsClient.UpdateActiveChannel("chID")
|
||||
resp = <-wsClient.ResponseChannel
|
||||
require.Nil(t, resp.Error)
|
||||
require.Equal(t, resp.SeqReply, wsClient.Sequence-1, "bad sequence number")
|
||||
|
||||
wsClient.UpdateActiveTeam("teamID")
|
||||
resp = <-wsClient.ResponseChannel
|
||||
require.Nil(t, resp.Error)
|
||||
require.Equal(t, resp.SeqReply, wsClient.Sequence-1, "bad sequence number")
|
||||
}
|
||||
|
||||
func TestWebSocketUpgrade(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user