@pipecat-ai/websocket-transport 1.6.6 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4187,6 +4187,8 @@ class $7f42eda74f1b1632$export$de21836fc42c6f9c extends (0, $kR6tG$Transport) {
4187
4187
  const camelKey = snakeToCamel(key);
4188
4188
  if (camelKey === "wsUrl") {
4189
4189
  if (typeof val !== "string") throw new (0, $kR6tG$RTVIError)(`Invalid type for wsUrl: expected string, got ${typeof val}`);
4190
+ } else if (camelKey === "token") {
4191
+ if (typeof val !== "string") throw new (0, $kR6tG$RTVIError)(`Invalid type for token: expected string, got ${typeof val}`);
4190
4192
  } else throw new (0, $kR6tG$RTVIError)(`Unrecognized connection parameter: ${key}.`);
4191
4193
  fixedParams[camelKey] = val;
4192
4194
  }
@@ -4196,6 +4198,10 @@ class $7f42eda74f1b1632$export$de21836fc42c6f9c extends (0, $kR6tG$Transport) {
4196
4198
  if (this._abortController?.signal.aborted) return;
4197
4199
  this.state = "connecting";
4198
4200
  this._wsUrl = connectParams?.wsUrl ?? connectParams?.ws_url ?? this._wsUrl;
4201
+ if (connectParams?.token) {
4202
+ const separator = this._wsUrl.includes("?") ? "&" : "?";
4203
+ this._wsUrl = `${this._wsUrl}${separator}token=${encodeURIComponent(connectParams.token)}`;
4204
+ }
4199
4205
  if (!this._wsUrl) {
4200
4206
  (0, $kR6tG$logger).error("No url provided for connection");
4201
4207
  this.state = "error";