Merge pull request #114 from aryzing/patch-1

Update utils.js
This commit is contained in:
Kevin Jahns 2022-08-19 15:02:56 +02:00 committed by GitHub
commit 20c1ac2619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,6 +168,10 @@ const messageListener = (conn, doc, message) => {
case messageSync: case messageSync:
encoding.writeVarUint(encoder, messageSync) encoding.writeVarUint(encoder, messageSync)
syncProtocol.readSyncMessage(decoder, encoder, doc, null) syncProtocol.readSyncMessage(decoder, encoder, doc, null)
// If the `encoder` only contains the type of reply message and no
// message, there is no need to send the message. When `encoder` only
// contains the type of reply, its length is 1.
if (encoding.length(encoder) > 1) { if (encoding.length(encoder) > 1) {
send(doc, conn, encoding.toUint8Array(encoder)) send(doc, conn, encoding.toUint8Array(encoder))
} }