- Go 50.3%
- JavaScript 33%
- HTML 16.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Comment out the p2p HTTP bridge for now as it just adds more complexity. Currently doesn't work on Dendrite@8691ef5f0753f67ad37cc052c8bb50f528483e64 but it does at least start poking the database! |
||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| index.html | ||
| main.go | ||
| package.json | ||
| README.md | ||
| sw.js | ||
| webpack.config.js | ||
dendrite-service-worker
This is an experimental JS library which wraps a WASM-compiled Dendrite (golang Matrix homeserver) into a web browser service worker.
It's intended to be imported by a Matrix webclient such as Riot/Web in order to embed a homeserver in the browser for use with experimental P2P Matrix.
It relies on a branch of Dendrite which uses the go-sqlite3-js driver for storage (thus delegating SQL to sql.js, running in-browser), and the go-http-js-libp2p transport for HTTP (thus tunnelling HTTP over libp2p via js-libp2p, running in-browser).
In order to bootstrap, we start off with a mock dendrite in main.go, which is built via:
GOOS=js GOARCH=wasm go build -o main.wasm
It's unclear at this stage whether the library should provide the service worker script (sw.js) or if the calling application should.
To build dendrite, go to the dendrite repo and: (may need to be on kegan/wasm):
$ GOOS=js GOARCH=wasm go build -o main.wasm ./cmd/dendritejs
$ cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
If you update go-sqlite-js you need to:
$ yarn add "https://github.com/matrix-org/go-sqlite3-js#master"
And to pull in the latest Go code in dendrite:
$ go get github.com/matrix-org/go-sqlite3-js@master