File tree Expand file tree Collapse file tree 3 files changed +18
-14
lines changed
Expand file tree Collapse file tree 3 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -43,19 +43,15 @@ export class MessageReceiver {
4343
4444 message . writeVarUint ( MessageType . Sync )
4545
46- try {
47- const syncMessageType = readSyncMessage (
48- message . decoder ,
49- message . encoder ,
50- provider . document ,
51- provider ,
52- )
53-
54- if ( emitSynced && syncMessageType === messageYjsSyncStep2 ) {
55- provider . synced = true
56- }
57- } catch ( e ) {
58- // TODO: That shouldn’t happen … but it does. Remove the try/catch and run the tests.
46+ const syncMessageType = readSyncMessage (
47+ message . decoder ,
48+ message . encoder ,
49+ provider . document ,
50+ provider ,
51+ )
52+
53+ if ( emitSynced && syncMessageType === messageYjsSyncStep2 ) {
54+ provider . synced = true
5955 }
6056 }
6157
Original file line number Diff line number Diff line change 99 Encoder ,
1010 toUint8Array ,
1111 writeVarUint ,
12+ length ,
1213} from 'lib0/encoding'
1314import { MessageType } from './types'
1415
@@ -47,4 +48,8 @@ export class IncomingMessage {
4748 writeVarUint ( type : MessageType ) {
4849 writeVarUint ( this . encoder , type )
4950 }
51+
52+ get length ( ) : number {
53+ return length ( this . encoder )
54+ }
5055}
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ export class MessageReceiver {
2828 case MessageType . Sync :
2929 message . writeVarUint ( MessageType . Sync )
3030 this . readSyncMessage ( message , connection )
31- connection . send ( message . toUint8Array ( ) )
31+
32+ if ( message . length > 1 ) {
33+ connection . send ( message . toUint8Array ( ) )
34+ }
3235
3336 break
3437 case MessageType . Awareness :
You can’t perform that action at this time.
0 commit comments