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

Commit

Permalink
chore: add websocket all filter to circuit example
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Dec 16, 2020
1 parent d200857 commit 40a6ac5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"delay": "^4.4.0",
"ipfs": "^0.52.2",
"ipfs-pubsub-room": "^2.0.1",
"libp2p-websockets": "^0.15.0",
"uint8arrays": "^1.1.0"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions examples/circuit-relaying/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
'use strict'

const IPFS = require('ipfs')
const WS = require('libp2p-websockets')
const filters = require('libp2p-websockets/src/filters')
const transportKey = WS.prototype[Symbol.toStringTag]
const Helpers = require('./helpers')

document.addEventListener('DOMContentLoaded', async () => {
Expand Down Expand Up @@ -38,6 +41,18 @@ document.addEventListener('DOMContentLoaded', async () => {
},
config: {
Bootstrap: []
},
libp2p: {
config: {
transport: {
// This is added for local demo!
// In a production environment the default filter should be used
// where only DNS + WSS addresses will be dialed by websockets in the browser.
[transportKey]: {
filter: filters.all
}
}
}
}
})

Expand Down

0 comments on commit 40a6ac5

Please sign in to comment.