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:
Raja Subramanian
2025-08-07 22:37:08 +05:30
committed by GitHub
parent 5ca1626439
commit 5d44cf6d57
4 changed files with 42 additions and 31 deletions
+6 -8
View File
@@ -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)