Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 898a757

Browse files
committed
chore: add websocket all filter to circuit example
1 parent 2c5a6da commit 898a757

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

examples/circuit-relaying/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"delay": "^4.4.0",
1818
"ipfs": "^0.52.2",
1919
"ipfs-pubsub-room": "^2.0.1",
20+
"libp2p-websockets": "^0.15.0",
2021
"uint8arrays": "^1.1.0"
2122
},
2223
"devDependencies": {

examples/circuit-relaying/src/app.js

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
'use strict'
33

44
const IPFS = require('ipfs')
5+
const WS = require('libp2p-websockets')
6+
const filters = require('libp2p-websockets/src/filters')
7+
const transportKey = WS.prototype[Symbol.toStringTag]
58
const Helpers = require('./helpers')
69

710
document.addEventListener('DOMContentLoaded', async () => {
@@ -38,6 +41,18 @@ document.addEventListener('DOMContentLoaded', async () => {
3841
},
3942
config: {
4043
Bootstrap: []
44+
},
45+
libp2p: {
46+
config: {
47+
transport: {
48+
// This is added for local demo!
49+
// In a production environment the default filter should be used
50+
// where only DNS + WSS addresses will be dialed by websockets in the browser.
51+
[transportKey]: {
52+
filter: filters.all
53+
}
54+
}
55+
}
4156
}
4257
})
4358

0 commit comments

Comments
 (0)