check for responsiveness when maxBufferSize is set
This commit is contained in:
@@ -213,7 +213,7 @@ export default function extendConnector (Y/* :any */) {
|
||||
self.broadcastOpBuffer = ops.slice(i)
|
||||
self.broadcast(encoder.createBuffer())
|
||||
if (i !== length) {
|
||||
setTimeout(broadcastOperations, 100)
|
||||
self.whenRemoteResponsive().then(broadcastOperations)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,20 @@ export default function extendConnector (Y/* :any */) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Somehow check the responsiveness of the remote clients/server
|
||||
* Default behavior:
|
||||
* Wait 100ms before broadcasting the next batch of operations
|
||||
*
|
||||
* Only used when maxBufferLength is set
|
||||
*
|
||||
*/
|
||||
whenRemoteResponsive () {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(resolve, 100)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
You received a raw message, and you know that it is intended for Yjs. Then call this function.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user