Skip to content

Commit

Permalink
fix(core): websocket transport
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanssen0 committed Oct 11, 2024
1 parent a91e1a6 commit acfc050
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .changeset/kind-chicken-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@ckb-ccc/core": patch
"@ckb-ccc/ccc": patch
"ckb-ccc": patch
"@ckb-ccc/connector": patch
"@ckb-ccc/connector-react": patch
"@ckb-ccc/eip6963": patch
"@ckb-ccc/joy-id": patch
"@ckb-ccc/lumos-patches": patch
"@ckb-ccc/nip07": patch
"@ckb-ccc/okx": patch
"@ckb-ccc/rei": patch
"@ckb-ccc/uni-sat": patch
"@ckb-ccc/utxo-global": patch
"@ckb-ccc/xverse": patch
---

fix(core): websocket transport
6 changes: 5 additions & 1 deletion packages/core/src/client/transports/webSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export class TransportWebSocket implements Transport {
request(data: JsonRpcPayload) {
const socket = (this.socket ?? Promise.resolve(undefined)).then(
(existed) => {
if (existed && existed.readyState === existed.OPEN) {
if (
existed &&
existed.readyState !== existed.CLOSING &&
existed.readyState !== existed.CLOSED
) {
return existed;
}

Expand Down

0 comments on commit acfc050

Please sign in to comment.