use protobuf for clients with protocol > 1 (#52)

This commit is contained in:
David Zhao
2021-07-13 22:28:34 -07:00
committed by GitHub
parent 850fecf931
commit 53b52a67ca
3 changed files with 14 additions and 4 deletions
+6 -4
View File
@@ -45,10 +45,12 @@ func (c *WSSignalConnection) ReadRequest() (*livekit.SignalRequest, error) {
msg := &livekit.SignalRequest{}
switch messageType {
case websocket.BinaryMessage:
c.mu.Lock()
// switch to protobuf if client supports it
c.useJSON = false
c.mu.Unlock()
if c.useJSON {
c.mu.Lock()
// switch to protobuf if client supports it
c.useJSON = false
c.mu.Unlock()
}
// protobuf encoded
err := proto.Unmarshal(payload, msg)
return msg, err