Skip to content

Commit 220a766

Browse files
[TS SDK] Fix WebSocket constructor miss in Browser (MystenLabs#16126)
## Description Describe the changes or additions included in this PR. Reason: When using WebSocket in the browser, the value in option is still used by default. This will result in an error: ``` Uncaught Error: Missing WebSocket constructor ``` But in the documentation, it is not mentioned that the constructor needs to be set to window.WebSocket So this should be fixed --------- Co-authored-by: hayes-mysten <[email protected]>
1 parent 6b54be8 commit 220a766

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/young-mayflies-sit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@mysten/sui.js': patch
3+
---
4+
5+
Fix WebSocket constructor not being properly assigned in SuiClient HTTP transport

sdk/typescript/src/client/http-transport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class SuiHTTPTransport implements SuiTransport {
7676
this.#websocketClient = new WebsocketClient(
7777
this.#options.websocket?.url ?? this.#options.url,
7878
{
79-
WebSocketConstructor: this.#options.WebSocketConstructor,
79+
WebSocketConstructor,
8080
...this.#options.websocket,
8181
},
8282
);

0 commit comments

Comments
 (0)