Runnable examples for embedding and using ygo. Each is a go run-able
program with its own README and a test that runs it. collab-server and
offline-first use SQLite and are modules of their own (cd into them to
run them); the others build with the core module alone. collab-server and offline-first use the
SQLite store, so each is a module of its own: run them from their
directory (cd examples/collab-server && go run .). Run ./tools/go-work.sh
once at the repository root first: they then build against this checkout
(a release tag's checkout does not carry their checksums of that release,
which are committed after its tags; without a workspace, go mod tidy in
the example's directory fetches them). collab-client is part
of the core module (go run ./examples/collab-client).
Embed the WebSocket sync server and wire its hooks (OnConnect, ReadOnly, OnChange, OnLoadDocument), resource caps, a SQLite store, and a /stats endpoint
Documents that converge with no server: y-protocols messages (package protocol) over Go channels, live forwarding with OnUpdate, a late peer, an offline one
Command collab-editor serves a collaborative text editor: a ygo server and one web page that edits a shared document with the stock Yjs stack (yjs, y-websocket, y-codemirror.next, loaded from esm.sh: no npm, no build step).
Command collab-editor serves a collaborative text editor: a ygo server and one web page that edits a shared document with the stock Yjs stack (yjs, y-websocket, y-codemirror.next, loaded from esm.sh: no npm, no build step).
Command snapshot-history keeps a document's history readable: a snapshot marks a moment, and any marked version can be read back later, deleted text included.
Command snapshot-history keeps a document's history readable: a snapshot marks a moment, and any marked version can be read back later, deleted text included.
Click to show internal directories.
Click to hide internal directories.
go.dev uses cookies from Google to deliver and enhance the quality of its services and to
analyze traffic. Learn more.