Merge pull request #1989 from waku-org/fix/transport-filter-wss

fix: filter for wss in libp2p websocket transport
This commit is contained in:
Arseniy Klempner 2024-05-06 16:45:57 -07:00 committed by GitHub
commit 21aa22f320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -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,
@ -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,