Skip to content

Commit

Permalink
Merge pull request #1989 from waku-org/fix/transport-filter-wss
Browse files Browse the repository at this point in the history
fix: filter for wss in libp2p websocket transport
  • Loading branch information
adklempner authored May 6, 2024
2 parents 3d92f19 + 682cc66 commit 21aa22f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/sdk/src/utils/libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { identify } from "@libp2p/identify";
import { mplex } from "@libp2p/mplex";
import { ping } from "@libp2p/ping";
import { webSockets } from "@libp2p/websockets";
import { all as filterAll } from "@libp2p/websockets/filters";
import { all as filterAll, wss } from "@libp2p/websockets/filters";
import { wakuMetadata } from "@waku/core";
import {
type CreateLibp2pOptions,
Expand Down Expand Up @@ -64,11 +64,13 @@ export async function defaultLibp2p(
? { metadata: wakuMetadata(shardInfo) }
: {};

const filter = process?.env?.NODE_ENV === "test" ? filterAll : wss;

return createLibp2p({
connectionManager: {
minConnections: 1
},
transports: [webSockets({ filter: filterAll })],
transports: [webSockets({ filter })],
streamMuxers: [mplex()],
connectionEncryption: [noise()],
...options,
Expand Down

0 comments on commit 21aa22f

Please sign in to comment.