Waku Web Chat POC
Go to file
oskarth 00f16c5f1e
Update README.md
2021-07-14 15:24:35 +08:00
browser Show text received 2020-10-19 13:19:46 +08:00
nodejs Start to port nodejs changes to browser 2020-10-16 13:53:22 +08:00
patches Add hacky patches for nim-waku interop 2020-09-21 12:57:00 +08:00
.gitignore Update README 2020-09-21 12:37:52 +08:00
README.md Update README.md 2021-07-14 15:24:35 +08:00

README.md

DEPRECATED: See js-waku https://github.com/status-im/js-waku for a better and up to date version

Waku Web Chat Example

This is just a POC to showcase Waku usage from the browser.

Shamelessly based on https://github.com/libp2p/js-libp2p-examples/

Install

(cd browser && npm install)
(cd nodejs && npm install)

Run

Run bootstrap node:

cd nodejs/bootstrap
node index.js

Run nodejs node:

cd nodejs/src
node index.js

Run browser node:

cd browser
npm start 

It may take a while for the browser node to connect with the nodejs node.

You may start multiple browser or nodejs nodes but only one bootstrap node.

Patches

See patches folder for current hacks to get basic interop with nim-waku.

If there are problems applying them, comment out postinstall in package.json.

Interop with nim-waku

Go to https://github.com/status-im/nim-waku/ and build wakunode2.

Then run it:

./build/wakunode2 --ports-shift:0

Note the "Listening on" address in logs. E.g. /ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmVKynP3QDpjxS2gujvy2Bp3BEKp8NzKmYspxDEVAGHftG.

Call nodejs node with it as argument:

node index.js /ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmVKynP3QDpjxS2gujvy2Bp3BEKp8NzKmYspxDEVAGHftG

You should notice in the nim-waku logs that messages are getting through. However, the protobuf isn't parsed.

The WakuMessage wrapper is also missing, meaning this current implementation is not according to spec.

WakuMessage support

There is a flag for using WakuMessage in both NodeJS and browser version.

Debugging Node version

Run eg

DEBUG=libp2p:gossipsub* node index.js /ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAm8btHBwum77YuqNgGK8yJGdPAHF5xGrfNMbKEXnyqN35i