-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use native
WebSocket
in server runtimes that support it (#2500)
* Use native `WebSocket` in server runtimes that support it * Create witty-camels-remember.md
- Loading branch information
1 parent
c1ae0f1
commit 82c57c6
Showing
2 changed files
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@solana/ws-impl": patch | ||
--- | ||
|
||
Use native `WebSocket` for compatibility with server runtimes that support it, like Deno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// When building the browser bundle, this import gets replaced by `globalThis.WebSocket`. | ||
import WebSocketImpl from 'ws'; | ||
|
||
export default WebSocketImpl; | ||
export default globalThis.WebSocket | ||
? globalThis.WebSocket // Use native `WebSocket` in runtimes that support it (eg. Deno) | ||
: WebSocketImpl; |