mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 00:42:25 +02:00
Add callback on received RTT.
This commit is contained in:
parent
f4d4d5fb4d
commit
acbb47a100
|
@ -90,6 +90,7 @@ type Client struct {
|
|||
OnLookupCountry func(*Client) string
|
||||
OnClosed func(*Client)
|
||||
OnMessageReceived func(*Client, []byte)
|
||||
OnRTTReceived func(*Client, time.Duration)
|
||||
}
|
||||
|
||||
func NewClient(conn *websocket.Conn, remoteAddress string, agent string) (*Client, error) {
|
||||
|
@ -110,6 +111,7 @@ func NewClient(conn *websocket.Conn, remoteAddress string, agent string) (*Clien
|
|||
OnLookupCountry: func(client *Client) string { return unknownCountry },
|
||||
OnClosed: func(client *Client) {},
|
||||
OnMessageReceived: func(client *Client, data []byte) {},
|
||||
OnRTTReceived: func(client *Client, rtt time.Duration) {},
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
|
@ -234,6 +236,7 @@ func (c *Client) ReadPump() {
|
|||
} else {
|
||||
log.Printf("Client from %s has RTT of %d ms (%s)", addr, rtt_ms, rtt)
|
||||
}
|
||||
c.OnRTTReceived(c, rtt)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue