mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2023-10-21 07:33:40 -05:00
Send initial "welcome" message when clients connect.
This can be used to detect server features before performing the actual "hello" handshake.
This commit is contained in:
+23
@@ -473,6 +473,29 @@ func performHousekeeping(hub *Hub, now time.Time) *sync.WaitGroup {
|
||||
return &wg
|
||||
}
|
||||
|
||||
func TestInitialWelcome(t *testing.T) {
|
||||
hub, _, _, server := CreateHubForTest(t)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
|
||||
defer cancel()
|
||||
|
||||
client := NewTestClientContext(ctx, t, server, hub)
|
||||
defer client.CloseWithBye()
|
||||
|
||||
msg, err := client.RunUntilMessage(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if msg.Type != "welcome" {
|
||||
t.Errorf("Expected \"welcome\" message, got %+v", msg)
|
||||
} else if msg.Welcome.Version == "" {
|
||||
t.Errorf("Expected welcome version, got %+v", msg)
|
||||
} else if len(msg.Welcome.Features) == 0 {
|
||||
t.Errorf("Expected welcome features, got %+v", msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpectClientHello(t *testing.T) {
|
||||
hub, _, _, server := CreateHubForTest(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user