mirror of
https://github.com/livekit/livekit.git
synced 2026-08-26 15:50:09 +00:00
basic integration test
This commit is contained in:
@@ -3,6 +3,7 @@ package client
|
||||
import (
|
||||
"container/ring"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -254,6 +255,20 @@ func (c *RTCClient) Run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *RTCClient) WaitUntilConnected() error {
|
||||
ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return errors.New("could not connect after timeout")
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
if c.iceConnected {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *RTCClient) ReadResponse() (*livekit.SignalResponse, error) {
|
||||
for {
|
||||
// handle special messages and pass on the rest
|
||||
|
||||
Reference in New Issue
Block a user