@hocuspocus/provider
Advanced tools
Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.0.0-alpha.16](https://github.com/ueberdosis/hocuspocus/compare/@hocuspocus/provider@1.0.0-alpha.15...@hocuspocus/provider@1.0.0-alpha.16) (2021-09-17) | ||
### Bug Fixes | ||
* Remote client awareness not immediately available ([37703f6](https://github.com/ueberdosis/hocuspocus/commit/37703f695f6bf3b0508c287294c5d26d2e888c37)) | ||
# [1.0.0-alpha.15](https://github.com/ueberdosis/hocuspocus/compare/@hocuspocus/provider@1.0.0-alpha.14...@hocuspocus/provider@1.0.0-alpha.15) (2021-09-14) | ||
@@ -8,0 +19,0 @@ |
@@ -1577,3 +1577,4 @@ import * as Y from 'yjs'; | ||
apply(provider, emitSynced = true) { | ||
const type = this.message.readVarUint(); | ||
const { message } = this; | ||
const type = message.readVarUint(); | ||
switch (type) { | ||
@@ -1595,12 +1596,2 @@ case MessageType.Sync: | ||
} | ||
} | ||
applySyncMessage(provider, emitSynced) { | ||
const { message } = this; | ||
message.writeVarUint(MessageType.Sync); | ||
// Apply update | ||
const syncMessageType = readSyncMessage(message.decoder, message.encoder, provider.document, provider); | ||
// Synced | ||
if (emitSynced && syncMessageType === messageYjsSyncStep2) { | ||
provider.synced = true; | ||
} | ||
// Reply | ||
@@ -1620,2 +1611,12 @@ if (message.length() > 1) { | ||
} | ||
applySyncMessage(provider, emitSynced) { | ||
const { message } = this; | ||
message.writeVarUint(MessageType.Sync); | ||
// Apply update | ||
const syncMessageType = readSyncMessage(message.decoder, message.encoder, provider.document, provider); | ||
// Synced once we receive Step2 | ||
if (emitSynced && syncMessageType === messageYjsSyncStep2) { | ||
provider.synced = true; | ||
} | ||
} | ||
applyAwarenessMessage(provider) { | ||
@@ -1622,0 +1623,0 @@ const { message } = this; |
@@ -43,5 +43,6 @@ /// <reference types="node" /> | ||
/** | ||
* Send first sync step | ||
* Send the current document awareness to the client, if any | ||
* @private | ||
*/ | ||
private sendCurrentAwareness; | ||
/** | ||
@@ -48,0 +49,0 @@ * Handle an incoming message |
{ | ||
"name": "@hocuspocus/provider", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"description": "hocuspocus provider", | ||
@@ -31,3 +31,3 @@ "homepage": "https://hocuspocus.dev", | ||
}, | ||
"gitHead": "d84b5516f65dfe096fd6c633f96309a6f65a9811", | ||
"gitHead": "981e76320fd0bac82cbbdb027ec3c91a4c6cfce4", | ||
"publishConfig": { | ||
@@ -34,0 +34,0 @@ "access": "public" |
@@ -26,3 +26,4 @@ import * as awarenessProtocol from 'y-protocols/awareness' | ||
public apply(provider: HocuspocusProvider, emitSynced = true) { | ||
const type = this.message.readVarUint() | ||
const { message } = this | ||
const type = message.readVarUint() | ||
@@ -49,2 +50,15 @@ switch (type) { | ||
} | ||
// Reply | ||
if (message.length() > 1) { | ||
if (this.broadcasted) { | ||
// TODO: Some weird TypeScript error | ||
// @ts-ignore | ||
provider.broadcast(OutgoingMessage, { encoder: message.encoder }) | ||
} else { | ||
// TODO: Some weird TypeScript error | ||
// @ts-ignore | ||
provider.send(OutgoingMessage, { encoder: message.encoder }) | ||
} | ||
} | ||
} | ||
@@ -65,19 +79,6 @@ | ||
// Synced | ||
// Synced once we receive Step2 | ||
if (emitSynced && syncMessageType === messageYjsSyncStep2) { | ||
provider.synced = true | ||
} | ||
// Reply | ||
if (message.length() > 1) { | ||
if (this.broadcasted) { | ||
// TODO: Some weird TypeScript error | ||
// @ts-ignore | ||
provider.broadcast(OutgoingMessage, { encoder: message.encoder }) | ||
} else { | ||
// TODO: Some weird TypeScript error | ||
// @ts-ignore | ||
provider.send(OutgoingMessage, { encoder: message.encoder }) | ||
} | ||
} | ||
} | ||
@@ -84,0 +85,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
531240
5985