Skip to content

Commit 6e9444c

Browse files
jamonholmgrenstainless-app[bot]
authored andcommitted
fix(realtime): call .toString() on WebSocket url (#1324)
The [WebSocket spec at WHATWG](https://websockets.spec.whatwg.org/#ref-for-dom-websocket-websocket%E2%91%A0) indicates that the `url` parameter of the WebSocket constructor is a string. Some implementations (like Chrome) will accept a URL object, but calling .toString() should work for all cases. Fixes #1323.
1 parent c91ebef commit 6e9444c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/beta/realtime/websocket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter {
5353
props.onURL?.(this.url);
5454

5555
// @ts-ignore
56-
this.socket = new WebSocket(this.url, [
56+
this.socket = new WebSocket(this.url.toString(), [
5757
'realtime',
5858
...(isAzure(client) ? [] : [`openai-insecure-api-key.${client.apiKey}`]),
5959
'openai-beta.realtime-v1',

0 commit comments

Comments
 (0)