How to use the y-protocols/sync.js.writeUpdate function in y-protocols

To help you get started, we’ve selected a few y-protocols examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yjs / yjs / tests / helper.js View on Github external
y.mMux(() => {
    if (transaction.encodedStructsLen > 0) {
      const encoder = encoding.createEncoder()
      syncProtocol.writeUpdate(encoder, transaction.encodedStructsLen, transaction.encodedStructs)
      broadcastMessage(y, encoding.toBuffer(encoder))
    }
  })
}
github yjs / y-webrtc / src / y-webrtc.js View on Github external
this._docUpdateHandler = (update, origin) => {
      if (origin !== this) {
        const encoder = encoding.createEncoder()
        encoding.writeVarUint(encoder, messageSync)
        syncProtocol.writeUpdate(encoder, update)
        broadcastRoomMessage(this, encoding.toUint8Array(encoder))
      }
    }
    /**