Skip to content

expose missing parts that allow to decode binary messages#712

Open
vane wants to merge 1 commit intoyjs:mainfrom
vane:expose-binary-decoding
Open

expose missing parts that allow to decode binary messages#712
vane wants to merge 1 commit intoyjs:mainfrom
vane:expose-binary-decoding

Conversation

@vane
Copy link
Copy Markdown

@vane vane commented May 16, 2025

There are not exposed parts that block decoding binary messages from other parts of application.
With those two exports it's possible with following code

import * as Y from "yjs"
import * as decoding from "lib0/decoding"
const doc = Y.Doc()
doc.on("update", (e) => {
	const structs = []
	const updateDecoder = new Y.UpdateDecoderV1(decoding.createDecoder(e))
	const lazyDecoder = new Y.LazyDecoder(updateDecoder)
	for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {
		structs.push(curr)
	}
	const deleteSet = Y.readDeleteSet(updateDecoder)
	console.log(structs, deleteSet)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant