File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,25 +120,32 @@ in sync. This wraps an underlying efficient sync protocol to minimize both
120120round-trips and bandwidth used.
121121
122122 //* process 1 *
123- syncState, err := automerge.NewSyncState(doc)
123+ syncState := automerge.NewSyncState(doc)
124124 for {
125- m, valid, err := syncState.GenerateMessage()
125+ m, valid := syncState.GenerateMessage()
126126 if valid {
127- sendCh <- m
127+ sendCh <- m.Bytes()
128128 }
129+
129130 msg := <-recvCh
130- err := syncState.ReceiveMessage(msg)
131+ _, err := syncState.ReceiveMessage(msg)
132+ if err != nil {
133+ panic(err)
134+ }
131135 }
132136
133137 //* process 2 *
134- syncState, err := automerge.NewSyncState(doc)
138+ syncState := automerge.NewSyncState(doc)
135139 for {
136140 msg := <-sendCh
137- err := syncState.ReceiveMessage(msg)
141+ _, err := syncState.ReceiveMessage(msg)
142+ if err != nil {
143+ panic(err)
144+ }
138145
139- m, valid, err := syncState.GenerateMessage()
146+ m, valid := syncState.GenerateMessage()
140147 if valid {
141- recvCh <- m
148+ recvCh <- m.Bytes()
142149 }
143150 }
144151
You can’t perform that action at this time.
0 commit comments