|
@@ -21,7 +21,8 @@ import ShareJs from 'libs/sharejs'
|
|
|
import EditorWatchdogManager from '../connection/EditorWatchdogManager'
|
|
import EditorWatchdogManager from '../connection/EditorWatchdogManager'
|
|
|
|
|
|
|
|
let ShareJsDoc
|
|
let ShareJsDoc
|
|
|
-const SINGLE_USER_FLUSH_DELAY = 1000 // ms
|
|
|
|
|
|
|
+const SINGLE_USER_FLUSH_DELAY = 2000 // ms
|
|
|
|
|
+const MULTI_USER_FLUSH_DELAY = 500 // ms
|
|
|
|
|
|
|
|
export default ShareJsDoc = (function() {
|
|
export default ShareJsDoc = (function() {
|
|
|
ShareJsDoc = class ShareJsDoc extends EventEmitter {
|
|
ShareJsDoc = class ShareJsDoc extends EventEmitter {
|
|
@@ -106,8 +107,8 @@ export default ShareJsDoc = (function() {
|
|
|
})
|
|
})
|
|
|
this._doc.on('remoteop', (...args) => {
|
|
this._doc.on('remoteop', (...args) => {
|
|
|
// As soon as we're working with a collaborator, start sending
|
|
// As soon as we're working with a collaborator, start sending
|
|
|
- // ops as quickly as possible for low latency.
|
|
|
|
|
- this._doc.setFlushDelay(0)
|
|
|
|
|
|
|
+ // ops more frequently for low latency.
|
|
|
|
|
+ this._doc.setFlushDelay(MULTI_USER_FLUSH_DELAY)
|
|
|
return this.trigger('remoteop', ...Array.from(args))
|
|
return this.trigger('remoteop', ...Array.from(args))
|
|
|
})
|
|
})
|
|
|
this._doc.on('flipped_pending_to_inflight', () => {
|
|
this._doc.on('flipped_pending_to_inflight', () => {
|