Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marionauta/automerge-repo-network-websocket-bun
https://github.com/marionauta/automerge-repo-network-websocket-bun
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/marionauta/automerge-repo-network-websocket-bun
- Owner: marionauta
- License: mit
- Created: 2024-08-19T18:44:38.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T10:44:23.000Z (5 months ago)
- Last Synced: 2024-08-21T12:12:41.822Z (5 months ago)
- Language: TypeScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# automerge-repo-network-websocket-bun
An [automerge][automerge] [repo][automerge-repo] network adapter that uses
Bun's [server side WebSockets][bunws] to share documents.The code is mostly from the [official node implementation][amws] but modified
to work with Bun.## Usage
```typescript
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,
})
```[automerge]: https://automerge.org
[automerge-repo]: https://github.com/automerge/automerge-repo
[bunws]: https://bun.sh/docs/api/websockets
[amws]: https://github.com/automerge/automerge-repo/tree/main/packages/automerge-repo-network-websocket