cojson-transport-ws 0.8.13 → 0.8.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +163 -148
- package/dist/BatchedOutgoingMessages.js +3 -3
- package/dist/BatchedOutgoingMessages.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/serialization.js.map +1 -1
- package/dist/tests/BatchedOutgoingMessages.test.js +41 -11
- package/dist/tests/BatchedOutgoingMessages.test.js.map +1 -1
- package/dist/tests/createWebSocketPeer.test.js +9 -13
- package/dist/tests/createWebSocketPeer.test.js.map +1 -1
- package/package.json +5 -9
- package/src/BatchedOutgoingMessages.ts +36 -35
- package/src/index.ts +170 -163
- package/src/serialization.ts +25 -23
- package/src/tests/BatchedOutgoingMessages.test.ts +138 -106
- package/src/tests/createWebSocketPeer.test.ts +404 -411
- package/src/types.ts +19 -20
- package/tsconfig.json +2 -2
- package/.eslintrc.cjs +0 -24
- package/.prettierrc.js +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,437 +1,452 @@
|
|
|
1
1
|
# cojson-transport-nodejs-ws
|
|
2
2
|
|
|
3
|
+
## 0.8.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b6162f0: Less noisy logs if clients send empty WebSocket messages
|
|
8
|
+
- Updated dependencies [d433cf4]
|
|
9
|
+
- cojson@0.8.17
|
|
10
|
+
|
|
11
|
+
## 0.8.16
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [b934fab]
|
|
16
|
+
- cojson@0.8.16
|
|
17
|
+
|
|
3
18
|
## 0.8.13
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
6
21
|
|
|
7
|
-
-
|
|
22
|
+
- e0dd006: Add the onClose handler and improve the closing operation
|
|
8
23
|
|
|
9
24
|
## 0.8.12
|
|
10
25
|
|
|
11
26
|
### Patch Changes
|
|
12
27
|
|
|
13
|
-
-
|
|
14
|
-
|
|
28
|
+
- Updated dependencies [6ed75eb]
|
|
29
|
+
- cojson@0.8.12
|
|
15
30
|
|
|
16
31
|
## 0.8.11
|
|
17
32
|
|
|
18
33
|
### Patch Changes
|
|
19
34
|
|
|
20
|
-
-
|
|
21
|
-
|
|
35
|
+
- Updated dependencies [1ed4ab5]
|
|
36
|
+
- cojson@0.8.11
|
|
22
37
|
|
|
23
38
|
## 0.8.7
|
|
24
39
|
|
|
25
40
|
### Patch Changes
|
|
26
41
|
|
|
27
|
-
-
|
|
42
|
+
- e82cf3d: Enable WebSocket batching on client peers
|
|
28
43
|
|
|
29
44
|
## 0.8.6
|
|
30
45
|
|
|
31
46
|
### Patch Changes
|
|
32
47
|
|
|
33
|
-
-
|
|
48
|
+
- 5542fdb: Added batching to the WebSocket messsages
|
|
34
49
|
|
|
35
50
|
## 0.8.5
|
|
36
51
|
|
|
37
52
|
### Patch Changes
|
|
38
53
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
|
|
54
|
+
- Updated dependencies [c3f4e6b]
|
|
55
|
+
- Updated dependencies [d9152ed]
|
|
56
|
+
- cojson@0.8.5
|
|
42
57
|
|
|
43
58
|
## 0.8.3
|
|
44
59
|
|
|
45
60
|
### Patch Changes
|
|
46
61
|
|
|
47
|
-
-
|
|
48
|
-
|
|
62
|
+
- Updated dependencies
|
|
63
|
+
- cojson@0.8.3
|
|
49
64
|
|
|
50
65
|
## 0.8.0
|
|
51
66
|
|
|
52
67
|
### Patch Changes
|
|
53
68
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
69
|
+
- Updated dependencies [6a147c2]
|
|
70
|
+
- Updated dependencies [ad40b88]
|
|
71
|
+
- cojson@0.8.0
|
|
57
72
|
|
|
58
73
|
## 0.7.35
|
|
59
74
|
|
|
60
75
|
### Patch Changes
|
|
61
76
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
77
|
+
- f350e90: Added a priority system for the sync messages
|
|
78
|
+
- Updated dependencies [35bbcd9]
|
|
79
|
+
- Updated dependencies [f350e90]
|
|
80
|
+
- cojson@0.7.35
|
|
66
81
|
|
|
67
82
|
## 0.7.34
|
|
68
83
|
|
|
69
84
|
### Patch Changes
|
|
70
85
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
|
|
86
|
+
- 406ab9b: Remove WS buffer filling log message
|
|
87
|
+
- Updated dependencies [5d91f9f]
|
|
88
|
+
- Updated dependencies [5094e6d]
|
|
89
|
+
- Updated dependencies [b09589b]
|
|
90
|
+
- Updated dependencies [2c3a40c]
|
|
91
|
+
- Updated dependencies [4e16575]
|
|
92
|
+
- Updated dependencies [ea882ab]
|
|
93
|
+
- cojson@0.7.34
|
|
79
94
|
|
|
80
95
|
## 0.7.34-neverthrow.8
|
|
81
96
|
|
|
82
97
|
### Patch Changes
|
|
83
98
|
|
|
84
|
-
-
|
|
85
|
-
|
|
99
|
+
- Updated dependencies
|
|
100
|
+
- cojson@0.7.34-neverthrow.8
|
|
86
101
|
|
|
87
102
|
## 0.7.34-neverthrow.7
|
|
88
103
|
|
|
89
104
|
### Patch Changes
|
|
90
105
|
|
|
91
|
-
-
|
|
92
|
-
|
|
106
|
+
- Updated dependencies
|
|
107
|
+
- cojson@0.7.34-neverthrow.7
|
|
93
108
|
|
|
94
109
|
## 0.7.34-neverthrow.4
|
|
95
110
|
|
|
96
111
|
### Patch Changes
|
|
97
112
|
|
|
98
|
-
-
|
|
99
|
-
|
|
113
|
+
- Updated dependencies
|
|
114
|
+
- cojson@0.7.34-neverthrow.4
|
|
100
115
|
|
|
101
116
|
## 0.7.34-neverthrow.3
|
|
102
117
|
|
|
103
118
|
### Patch Changes
|
|
104
119
|
|
|
105
|
-
-
|
|
106
|
-
|
|
120
|
+
- Updated dependencies
|
|
121
|
+
- cojson@0.7.34-neverthrow.3
|
|
107
122
|
|
|
108
123
|
## 0.7.34-neverthrow.2
|
|
109
124
|
|
|
110
125
|
### Patch Changes
|
|
111
126
|
|
|
112
|
-
-
|
|
127
|
+
- Remove WS buffer filling log message
|
|
113
128
|
|
|
114
129
|
## 0.7.34-neverthrow.1
|
|
115
130
|
|
|
116
131
|
### Patch Changes
|
|
117
132
|
|
|
118
|
-
-
|
|
119
|
-
|
|
133
|
+
- Updated dependencies
|
|
134
|
+
- cojson@0.7.34-neverthrow.1
|
|
120
135
|
|
|
121
136
|
## 0.7.34-neverthrow.0
|
|
122
137
|
|
|
123
138
|
### Patch Changes
|
|
124
139
|
|
|
125
|
-
-
|
|
126
|
-
|
|
140
|
+
- Updated dependencies
|
|
141
|
+
- cojson@0.7.34-neverthrow.0
|
|
127
142
|
|
|
128
143
|
## 0.7.33
|
|
129
144
|
|
|
130
145
|
### Patch Changes
|
|
131
146
|
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
|
|
147
|
+
- fdde8db: Handle ws closing while buffering
|
|
148
|
+
- 07fe2b9: Wait if WS buffer is full
|
|
149
|
+
- 3bf5127: Allow crashing whole node on peer errors
|
|
150
|
+
- Updated dependencies [b297c93]
|
|
151
|
+
- Updated dependencies [3bf5127]
|
|
152
|
+
- Updated dependencies [a8b74ff]
|
|
153
|
+
- Updated dependencies [db53161]
|
|
154
|
+
- cojson@0.7.33
|
|
140
155
|
|
|
141
156
|
## 0.7.33-hotfixes.5
|
|
142
157
|
|
|
143
158
|
### Patch Changes
|
|
144
159
|
|
|
145
|
-
-
|
|
146
|
-
|
|
160
|
+
- Updated dependencies
|
|
161
|
+
- cojson@0.7.33-hotfixes.5
|
|
147
162
|
|
|
148
163
|
## 0.7.33-hotfixes.4
|
|
149
164
|
|
|
150
165
|
### Patch Changes
|
|
151
166
|
|
|
152
|
-
-
|
|
153
|
-
|
|
167
|
+
- Updated dependencies
|
|
168
|
+
- cojson@0.7.33-hotfixes.4
|
|
154
169
|
|
|
155
170
|
## 0.7.33-hotfixes.3
|
|
156
171
|
|
|
157
172
|
### Patch Changes
|
|
158
173
|
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
|
|
174
|
+
- Allow crashing whole node on peer errors
|
|
175
|
+
- Updated dependencies
|
|
176
|
+
- cojson@0.7.33-hotfixes.3
|
|
162
177
|
|
|
163
178
|
## 0.7.33-hotfixes.2
|
|
164
179
|
|
|
165
180
|
### Patch Changes
|
|
166
181
|
|
|
167
|
-
-
|
|
182
|
+
- Handle ws closing while buffering
|
|
168
183
|
|
|
169
184
|
## 0.7.33-hotfixes.1
|
|
170
185
|
|
|
171
186
|
### Patch Changes
|
|
172
187
|
|
|
173
|
-
-
|
|
188
|
+
- Wait if WS buffer is full
|
|
174
189
|
|
|
175
190
|
## 0.7.33-hotfixes.0
|
|
176
191
|
|
|
177
192
|
### Patch Changes
|
|
178
193
|
|
|
179
|
-
-
|
|
180
|
-
|
|
194
|
+
- Updated dependencies
|
|
195
|
+
- cojson@0.7.33-hotfixes.0
|
|
181
196
|
|
|
182
197
|
## 0.7.31
|
|
183
198
|
|
|
184
199
|
### Patch Changes
|
|
185
200
|
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
|
|
201
|
+
- Properly close connecting websockets
|
|
202
|
+
- Updated dependencies
|
|
203
|
+
- cojson@0.7.31
|
|
189
204
|
|
|
190
205
|
## 0.7.30
|
|
191
206
|
|
|
192
207
|
### Patch Changes
|
|
193
208
|
|
|
194
|
-
-
|
|
209
|
+
- Immediately resolve an already-open websocket
|
|
195
210
|
|
|
196
211
|
## 0.7.29
|
|
197
212
|
|
|
198
213
|
### Patch Changes
|
|
199
214
|
|
|
200
|
-
-
|
|
201
|
-
|
|
215
|
+
- Updated dependencies
|
|
216
|
+
- cojson@0.7.29
|
|
202
217
|
|
|
203
218
|
## 0.7.28
|
|
204
219
|
|
|
205
220
|
### Patch Changes
|
|
206
221
|
|
|
207
|
-
-
|
|
208
|
-
|
|
222
|
+
- Updated dependencies
|
|
223
|
+
- cojson@0.7.28
|
|
209
224
|
|
|
210
225
|
## 0.7.27
|
|
211
226
|
|
|
212
227
|
### Patch Changes
|
|
213
228
|
|
|
214
|
-
-
|
|
229
|
+
- Option to not expect pings
|
|
215
230
|
|
|
216
231
|
## 0.7.26
|
|
217
232
|
|
|
218
233
|
### Patch Changes
|
|
219
234
|
|
|
220
|
-
-
|
|
221
|
-
-
|
|
222
|
-
|
|
235
|
+
- Remove Effect from jazz/cojson internals
|
|
236
|
+
- Updated dependencies
|
|
237
|
+
- cojson@0.7.26
|
|
223
238
|
|
|
224
239
|
## 0.7.23
|
|
225
240
|
|
|
226
241
|
### Patch Changes
|
|
227
242
|
|
|
228
|
-
-
|
|
229
|
-
|
|
243
|
+
- Updated dependencies
|
|
244
|
+
- cojson@0.7.23
|
|
230
245
|
|
|
231
246
|
## 0.7.22
|
|
232
247
|
|
|
233
248
|
### Patch Changes
|
|
234
249
|
|
|
235
|
-
-
|
|
250
|
+
- Increase disconnect timeout for now
|
|
236
251
|
|
|
237
252
|
## 0.7.18
|
|
238
253
|
|
|
239
254
|
### Patch Changes
|
|
240
255
|
|
|
241
|
-
-
|
|
242
|
-
|
|
256
|
+
- Updated dependencies
|
|
257
|
+
- cojson@0.7.18
|
|
243
258
|
|
|
244
259
|
## 0.7.17
|
|
245
260
|
|
|
246
261
|
### Patch Changes
|
|
247
262
|
|
|
248
|
-
-
|
|
249
|
-
|
|
263
|
+
- Updated dependencies
|
|
264
|
+
- cojson@0.7.17
|
|
250
265
|
|
|
251
266
|
## 0.7.14
|
|
252
267
|
|
|
253
268
|
### Patch Changes
|
|
254
269
|
|
|
255
|
-
-
|
|
256
|
-
|
|
270
|
+
- Updated dependencies
|
|
271
|
+
- cojson@0.7.14
|
|
257
272
|
|
|
258
273
|
## 0.7.11
|
|
259
274
|
|
|
260
275
|
### Patch Changes
|
|
261
276
|
|
|
262
|
-
-
|
|
263
|
-
|
|
277
|
+
- Updated dependencies
|
|
278
|
+
- cojson@0.7.11
|
|
264
279
|
|
|
265
280
|
## 0.7.10
|
|
266
281
|
|
|
267
282
|
### Patch Changes
|
|
268
283
|
|
|
269
|
-
-
|
|
270
|
-
|
|
284
|
+
- Updated dependencies
|
|
285
|
+
- cojson@0.7.10
|
|
271
286
|
|
|
272
287
|
## 0.7.9
|
|
273
288
|
|
|
274
289
|
### Patch Changes
|
|
275
290
|
|
|
276
|
-
-
|
|
277
|
-
|
|
291
|
+
- Updated dependencies
|
|
292
|
+
- cojson@0.7.9
|
|
278
293
|
|
|
279
294
|
## 0.7.0
|
|
280
295
|
|
|
281
296
|
### Patch Changes
|
|
282
297
|
|
|
283
|
-
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
-
|
|
304
|
-
-
|
|
305
|
-
|
|
298
|
+
- c4151fc: Support stricter TS lint rules
|
|
299
|
+
- 21771c4: Reintroduce changes from main
|
|
300
|
+
- f0f6f1b: Clean up API more & re-add jazz-nodejs
|
|
301
|
+
- 627d895: Get rid of Co namespace
|
|
302
|
+
- a423eee: ignore error on ws close, fixing "Invalid state: Controller is already closed"
|
|
303
|
+
- Updated dependencies [1a35307]
|
|
304
|
+
- Updated dependencies [96c494f]
|
|
305
|
+
- Updated dependencies [19f52b7]
|
|
306
|
+
- Updated dependencies [d8fe2b1]
|
|
307
|
+
- Updated dependencies [1200aae]
|
|
308
|
+
- Updated dependencies [52675c9]
|
|
309
|
+
- Updated dependencies [1a35307]
|
|
310
|
+
- Updated dependencies [e299c3e]
|
|
311
|
+
- Updated dependencies [bf0f8ec]
|
|
312
|
+
- Updated dependencies [c4151fc]
|
|
313
|
+
- Updated dependencies [8636319]
|
|
314
|
+
- Updated dependencies [952982e]
|
|
315
|
+
- Updated dependencies [21771c4]
|
|
316
|
+
- Updated dependencies [69ac514]
|
|
317
|
+
- Updated dependencies [f0f6f1b]
|
|
318
|
+
- Updated dependencies [1a44f87]
|
|
319
|
+
- Updated dependencies [63374cc]
|
|
320
|
+
- cojson@0.7.0
|
|
306
321
|
|
|
307
322
|
## 0.7.0-alpha.42
|
|
308
323
|
|
|
309
324
|
### Patch Changes
|
|
310
325
|
|
|
311
|
-
-
|
|
312
|
-
|
|
326
|
+
- Updated dependencies
|
|
327
|
+
- cojson@0.7.0-alpha.42
|
|
313
328
|
|
|
314
329
|
## 0.7.0-alpha.41
|
|
315
330
|
|
|
316
331
|
### Patch Changes
|
|
317
332
|
|
|
318
|
-
-
|
|
333
|
+
- ignore error on ws close, fixing "Invalid state: Controller is already closed"
|
|
319
334
|
|
|
320
335
|
## 0.7.0-alpha.39
|
|
321
336
|
|
|
322
337
|
### Patch Changes
|
|
323
338
|
|
|
324
|
-
-
|
|
325
|
-
|
|
339
|
+
- Updated dependencies
|
|
340
|
+
- cojson@0.7.0-alpha.39
|
|
326
341
|
|
|
327
342
|
## 0.7.0-alpha.38
|
|
328
343
|
|
|
329
344
|
### Patch Changes
|
|
330
345
|
|
|
331
|
-
-
|
|
332
|
-
|
|
346
|
+
- Updated dependencies
|
|
347
|
+
- cojson@0.7.0-alpha.38
|
|
333
348
|
|
|
334
349
|
## 0.7.0-alpha.37
|
|
335
350
|
|
|
336
351
|
### Patch Changes
|
|
337
352
|
|
|
338
|
-
-
|
|
339
|
-
|
|
353
|
+
- Updated dependencies
|
|
354
|
+
- cojson@0.7.0-alpha.37
|
|
340
355
|
|
|
341
356
|
## 0.7.0-alpha.36
|
|
342
357
|
|
|
343
358
|
### Patch Changes
|
|
344
359
|
|
|
345
|
-
-
|
|
346
|
-
-
|
|
347
|
-
|
|
360
|
+
- Updated dependencies [1a35307]
|
|
361
|
+
- Updated dependencies [1a35307]
|
|
362
|
+
- cojson@0.7.0-alpha.36
|
|
348
363
|
|
|
349
364
|
## 0.7.0-alpha.35
|
|
350
365
|
|
|
351
366
|
### Patch Changes
|
|
352
367
|
|
|
353
|
-
-
|
|
354
|
-
|
|
368
|
+
- Updated dependencies
|
|
369
|
+
- cojson@0.7.0-alpha.35
|
|
355
370
|
|
|
356
371
|
## 0.7.0-alpha.29
|
|
357
372
|
|
|
358
373
|
### Patch Changes
|
|
359
374
|
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
|
|
375
|
+
- Reintroduce changes from main
|
|
376
|
+
- Updated dependencies
|
|
377
|
+
- cojson@0.7.0-alpha.29
|
|
363
378
|
|
|
364
379
|
## 0.7.0-alpha.28
|
|
365
380
|
|
|
366
381
|
### Patch Changes
|
|
367
382
|
|
|
368
|
-
-
|
|
369
|
-
|
|
383
|
+
- Updated dependencies
|
|
384
|
+
- cojson@0.7.0-alpha.28
|
|
370
385
|
|
|
371
386
|
## 0.7.0-alpha.27
|
|
372
387
|
|
|
373
388
|
### Patch Changes
|
|
374
389
|
|
|
375
|
-
-
|
|
376
|
-
|
|
390
|
+
- Updated dependencies
|
|
391
|
+
- cojson@0.7.0-alpha.27
|
|
377
392
|
|
|
378
393
|
## 0.7.0-alpha.24
|
|
379
394
|
|
|
380
395
|
### Patch Changes
|
|
381
396
|
|
|
382
|
-
-
|
|
383
|
-
|
|
397
|
+
- Updated dependencies
|
|
398
|
+
- cojson@0.7.0-alpha.24
|
|
384
399
|
|
|
385
400
|
## 0.7.0-alpha.11
|
|
386
401
|
|
|
387
402
|
### Patch Changes
|
|
388
403
|
|
|
389
|
-
-
|
|
390
|
-
-
|
|
391
|
-
|
|
404
|
+
- Support stricter TS lint rules
|
|
405
|
+
- Updated dependencies
|
|
406
|
+
- cojson@0.7.0-alpha.11
|
|
392
407
|
|
|
393
408
|
## 0.7.0-alpha.10
|
|
394
409
|
|
|
395
410
|
### Patch Changes
|
|
396
411
|
|
|
397
|
-
-
|
|
398
|
-
-
|
|
399
|
-
|
|
412
|
+
- Clean up API more & re-add jazz-nodejs
|
|
413
|
+
- Updated dependencies
|
|
414
|
+
- cojson@0.7.0-alpha.10
|
|
400
415
|
|
|
401
416
|
## 0.5.2-alpha.2
|
|
402
417
|
|
|
403
418
|
### Patch Changes
|
|
404
419
|
|
|
405
|
-
-
|
|
420
|
+
- Get rid of Co namespace
|
|
406
421
|
|
|
407
422
|
## 0.5.2-alpha.1
|
|
408
423
|
|
|
409
424
|
### Patch Changes
|
|
410
425
|
|
|
411
|
-
-
|
|
412
|
-
|
|
426
|
+
- Updated dependencies
|
|
427
|
+
- cojson@0.7.0-alpha.1
|
|
413
428
|
|
|
414
429
|
## 0.5.2-alpha.0
|
|
415
430
|
|
|
416
431
|
### Patch Changes
|
|
417
432
|
|
|
418
|
-
-
|
|
419
|
-
|
|
433
|
+
- Updated dependencies
|
|
434
|
+
- cojson@0.7.0-alpha.0
|
|
420
435
|
|
|
421
436
|
## 0.5.1
|
|
422
437
|
|
|
423
438
|
### Patch Changes
|
|
424
439
|
|
|
425
|
-
-
|
|
426
|
-
|
|
440
|
+
- Updated dependencies
|
|
441
|
+
- cojson@0.6.0
|
|
427
442
|
|
|
428
443
|
## 0.5.0
|
|
429
444
|
|
|
430
445
|
### Minor Changes
|
|
431
446
|
|
|
432
|
-
-
|
|
447
|
+
- Adding a lot of performance improvements to cojson, add a stresstest for the twit example and make that run smoother in a lot of ways.
|
|
433
448
|
|
|
434
449
|
### Patch Changes
|
|
435
450
|
|
|
436
|
-
-
|
|
437
|
-
|
|
451
|
+
- Updated dependencies
|
|
452
|
+
- cojson@0.5.0
|
|
@@ -3,7 +3,7 @@ export const MAX_OUTGOING_MESSAGES_CHUNK_BYTES = 25000;
|
|
|
3
3
|
export class BatchedOutgoingMessages {
|
|
4
4
|
constructor(send) {
|
|
5
5
|
this.send = send;
|
|
6
|
-
this.backlog =
|
|
6
|
+
this.backlog = "";
|
|
7
7
|
this.timeout = null;
|
|
8
8
|
}
|
|
9
9
|
push(msg) {
|
|
@@ -15,7 +15,7 @@ export class BatchedOutgoingMessages {
|
|
|
15
15
|
const backlogExists = this.backlog.length > 0;
|
|
16
16
|
if (maxChunkSizeReached && backlogExists) {
|
|
17
17
|
this.sendMessagesInBulk();
|
|
18
|
-
this.backlog = addMessageToBacklog(
|
|
18
|
+
this.backlog = addMessageToBacklog("", msg);
|
|
19
19
|
this.timeout = setTimeout(() => {
|
|
20
20
|
this.sendMessagesInBulk();
|
|
21
21
|
}, 0);
|
|
@@ -33,7 +33,7 @@ export class BatchedOutgoingMessages {
|
|
|
33
33
|
}
|
|
34
34
|
sendMessagesInBulk() {
|
|
35
35
|
this.send(this.backlog);
|
|
36
|
-
this.backlog =
|
|
36
|
+
this.backlog = "";
|
|
37
37
|
}
|
|
38
38
|
close() {
|
|
39
39
|
this.sendMessagesInBulk();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchedOutgoingMessages.js","sourceRoot":"","sources":["../src/BatchedOutgoingMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAM,CAAC;AAExD,MAAM,OAAO,uBAAuB;
|
|
1
|
+
{"version":3,"file":"BatchedOutgoingMessages.js","sourceRoot":"","sources":["../src/BatchedOutgoingMessages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,CAAC,MAAM,iCAAiC,GAAG,KAAM,CAAC;AAExD,MAAM,OAAO,uBAAuB;IAIlC,YAAoB,IAAgC;QAAhC,SAAI,GAAJ,IAAI,CAA4B;QAH5C,YAAO,GAAW,EAAE,CAAC;QACrB,YAAO,GAAyC,IAAI,CAAC;IAEN,CAAC;IAExD,IAAI,CAAC,GAAgB;QACnB,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAEvD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,mBAAmB,GACvB,OAAO,CAAC,MAAM,IAAI,iCAAiC,CAAC;QACtD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAE9C,IAAI,mBAAmB,IAAI,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC7B,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ function createPingTimeoutListener(enabled, callback) {
|
|
|
7
7
|
if (!enabled) {
|
|
8
8
|
return {
|
|
9
9
|
reset() { },
|
|
10
|
-
clear() { }
|
|
10
|
+
clear() { },
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
let pingTimeout = null;
|
|
@@ -20,7 +20,7 @@ function createPingTimeoutListener(enabled, callback) {
|
|
|
20
20
|
},
|
|
21
21
|
clear() {
|
|
22
22
|
pingTimeout && clearTimeout(pingTimeout);
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function waitForWebSocketOpen(websocket) {
|
|
@@ -95,6 +95,10 @@ export function createWebSocketPeer({ id, websocket, role, expectPings = true, b
|
|
|
95
95
|
});
|
|
96
96
|
const outgoingMessages = createOutgoingMessagesManager(websocket, batchingByDefault);
|
|
97
97
|
function handleIncomingMsg(event) {
|
|
98
|
+
if (event.data === "") {
|
|
99
|
+
console.log("client", id, "sent empty message");
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
98
102
|
const result = deserializeMessages(event.data);
|
|
99
103
|
if (!result.ok) {
|
|
100
104
|
console.error("Error while deserializing messages", event.data, result.error);
|