diff --git a/examples/browser-ipns-publish/index.html b/examples/browser-ipns-publish/index.html
index ce7c5c9187..40d5b4fbd2 100644
--- a/examples/browser-ipns-publish/index.html
+++ b/examples/browser-ipns-publish/index.html
@@ -137,6 +137,16 @@
>
Connect
+
+
+ For connecting to a local go-ipfs node, you may need to use
+
/ip4/127.0.0.1/tcp/4003/ws/p2p/QmTheirServerPeerId
+
diff --git a/examples/browser-ipns-publish/index.js b/examples/browser-ipns-publish/index.js
index e0e5ef72d2..6d5c850cf7 100644
--- a/examples/browser-ipns-publish/index.js
+++ b/examples/browser-ipns-publish/index.js
@@ -9,6 +9,10 @@ const cryptoKeys = require("human-crypto-keys"); // { getKeyPairFromSeed }
const uint8ArrayToString = require('uint8arrays/to-string')
const uint8ArrayFromString = require('uint8arrays/from-string')
+const WS = require('libp2p-websockets')
+const transportKey = WS.prototype[Symbol.toStringTag]
+const filters = require('libp2p-websockets/src/filters')
+
const { sleep, Logger, onEnterPress, catchAndLog } = require("./util");
async function main() {
@@ -39,6 +43,17 @@ async function main() {
ipfsBrowser = await IPFS.create({
pass: "01234567890123456789",
EXPERIMENTAL: { ipnsPubsub: true },
+ 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
+ }
+ }
+ }}
});
const { id } = await ipfsBrowser.id();
log(`Browser IPFS ready! Node id: ${id}`);