automerge-repo-network-websocket-bun
v0.1.0
Published
An [automerge][automerge] [repo][automerge-repo] network adapter that uses Bun's [server side WebSockets][bunws] to share documents.
Downloads
6
Readme
automerge-repo-network-websocket-bun
An automerge repo network adapter that uses Bun's server side WebSockets to share documents.
The code is mostly from the official node implementation but modified to work with Bun.
Usage
import { Repo } from "@automerge/automerge-repo";
import { BunWSServerAdapter } from "automerge-repo-network-websocket-bun";
const socketAdapter = new BunWSServerAdapter();
const repo = new Repo({
network: [socketAdapter],
// ...
});
Bun.serve({
fetch(request, server) {
// request upgrade logic
},
websocket: socketAdapter,
})