y-websocket
Advanced tools
Comparing version 1.3.16 to 1.3.17
@@ -165,17 +165,22 @@ const Y = require('yjs') | ||
const messageListener = (conn, doc, message) => { | ||
const encoder = encoding.createEncoder() | ||
const decoder = decoding.createDecoder(message) | ||
const messageType = decoding.readVarUint(decoder) | ||
switch (messageType) { | ||
case messageSync: | ||
encoding.writeVarUint(encoder, messageSync) | ||
syncProtocol.readSyncMessage(decoder, encoder, doc, null) | ||
if (encoding.length(encoder) > 1) { | ||
send(doc, conn, encoding.toUint8Array(encoder)) | ||
try { | ||
const encoder = encoding.createEncoder() | ||
const decoder = decoding.createDecoder(message) | ||
const messageType = decoding.readVarUint(decoder) | ||
switch (messageType) { | ||
case messageSync: | ||
encoding.writeVarUint(encoder, messageSync) | ||
syncProtocol.readSyncMessage(decoder, encoder, doc, null) | ||
if (encoding.length(encoder) > 1) { | ||
send(doc, conn, encoding.toUint8Array(encoder)) | ||
} | ||
break | ||
case messageAwareness: { | ||
awarenessProtocol.applyAwarenessUpdate(doc.awareness, decoding.readVarUint8Array(decoder), conn) | ||
break | ||
} | ||
break | ||
case messageAwareness: { | ||
awarenessProtocol.applyAwarenessUpdate(doc.awareness, decoding.readVarUint8Array(decoder), conn) | ||
break | ||
} | ||
} catch (err) { | ||
console.error(err) | ||
doc.emit('error', [err]) | ||
} | ||
@@ -182,0 +187,0 @@ } |
{ | ||
"name": "y-websocket", | ||
"version": "1.3.16", | ||
"version": "1.3.17", | ||
"description": "Websockets provider for Yjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/y-websocket.cjs", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78485
1188