Skip to content

Commit 21aa22f

Browse files
authored
Merge pull request #1989 from waku-org/fix/transport-filter-wss
fix: filter for wss in libp2p websocket transport
2 parents 3d92f19 + 682cc66 commit 21aa22f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/sdk/src/utils/libp2p.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { identify } from "@libp2p/identify";
55
import { mplex } from "@libp2p/mplex";
66
import { ping } from "@libp2p/ping";
77
import { webSockets } from "@libp2p/websockets";
8-
import { all as filterAll } from "@libp2p/websockets/filters";
8+
import { all as filterAll, wss } from "@libp2p/websockets/filters";
99
import { wakuMetadata } from "@waku/core";
1010
import {
1111
type CreateLibp2pOptions,
@@ -64,11 +64,13 @@ export async function defaultLibp2p(
6464
? { metadata: wakuMetadata(shardInfo) }
6565
: {};
6666

67+
const filter = process?.env?.NODE_ENV === "test" ? filterAll : wss;
68+
6769
return createLibp2p({
6870
connectionManager: {
6971
minConnections: 1
7072
},
71-
transports: [webSockets({ filter: filterAll })],
73+
transports: [webSockets({ filter })],
7274
streamMuxers: [mplex()],
7375
connectionEncryption: [noise()],
7476
...options,

0 commit comments

Comments
 (0)