Use wrapped join request to be able to support compressed and uncompressed. (#3838)
* Do no gzip join request * wrapped join request * deps
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
@@ -158,12 +156,12 @@ func NewWebSocketConn(host, token string, opts *Options) (*websocket.Conn, error
|
||||
}
|
||||
|
||||
if marshalled, err := proto.Marshal(joinRequest); err == nil {
|
||||
var buf bytes.Buffer
|
||||
writer := gzip.NewWriter(&buf)
|
||||
writer.Write(marshalled)
|
||||
writer.Close()
|
||||
|
||||
connectUrl += fmt.Sprintf("?join_request=%s", base64.URLEncoding.EncodeToString(buf.Bytes()))
|
||||
wrapped := &livekit.WrappedJoinRequest{
|
||||
JoinRequest: marshalled,
|
||||
}
|
||||
if marshalled, err := proto.Marshal(wrapped); err == nil {
|
||||
connectUrl += fmt.Sprintf("?join_request=%s", base64.URLEncoding.EncodeToString(marshalled))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
connectUrl += fmt.Sprintf("?protocol=%d", types.CurrentProtocol)
|
||||
|
||||
Reference in New Issue
Block a user