@@ -68,59 +68,10 @@ A stream ID must be locally unique for a Requester in a connection.
68
68
| __ REQUEST_N__ | 0x0015 | __ Request N__ : Request N more items |
69
69
| __ CANCEL__ | 0x0016 | __ Cancel Request__ : |
70
70
| __ RESPONSE__ | 0x0020 | __ Response__ : Response to a request. |
71
+ | __ ERROR__ | 0x0021 | __ Error__ : Response that is an error. |
71
72
| __ EXT__ | 0xFFFF | __ Extension Header__ : Used To Extend More Options As Well As Extensions. |
72
73
73
- ### Header Chains
74
-
75
- ReactiveSocket uses IPv6-style header chains to provide flexibility. The general layout of a ReactiveSocket
76
- frame is a Frame Header followed by 0 or more Headers.
77
-
78
- __ Note__ : Currently, only RESPONSEs use header chains.
79
-
80
- ```
81
- +----------------------------------------+
82
- | Frame Length (for TCP only) |
83
- +----------------------------------------+
84
- | Frame Header (version, Stream ID, etc.)|
85
- +----------------------------------------+
86
- | Header |
87
- +----------------------------------------+
88
- | Header |
89
- +----------------------------------------+
90
- | ...... |
91
- +----------------------------------------+
92
- | Header |
93
- +----------------------------------------+
94
- ```
95
-
96
- The general format for a header is given below.
97
-
98
- ```
99
- 0 1 2 3
100
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
101
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
102
- | Type |I| Header Length |
103
- +---------------+-+---------------------------------------------+
104
- Header Data (Depends on Type)
105
- ```
106
-
107
- * __ Type__ : (8) Type of header.
108
- * __ Flags__ :
109
- * (__ I__ )gnore: ignore current header if not understood.
110
- * __ Header Length__ : (23) Length of current header in bytes (23 = max 8,388,608 bytes). Includes
111
- the Type and Header Length fields.
112
-
113
- #### Header Types
114
-
115
- | Type | Value | Description |
116
- | :-----------------------------------| :-------| :------------|
117
- | __ HDR_RESERVED__ | 0x00 | __ Reserved__ |
118
- | __ HDR_NEXT__ | 0x22 | __ Next__ : |
119
- | __ HDR_COMPLETE__ | 0x23 | __ Complete__ : |
120
- | __ HDR_ERROR__ | 0x24 | __ Error__ : |
121
- | __ HDR_EXT__ | 0xFF | __ Extension Header__ : Used To Extend More Options As Well As Extensions. |
122
-
123
- __ Note__ : Headers Sent By Requesters Fall Into The 0x10 - 0x1F Range. Headers Sent By Responders Fall Into The 0x20 - 0x2F Range.
74
+ __ NOTE__ : In general Requesters send types 0x0010 to 0x001F and Responders send types 0x0020 to 0x002F.
124
75
125
76
### Setup Frame
126
77
@@ -281,87 +232,48 @@ Frame Contents
281
232
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
282
233
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
283
234
|R| Frame Length (for TCP only) |
284
- +---------------+-+------ -------+-------------------------------+
285
- | Version |I| Flags | Frame Type = RESPONSE |
286
- +---------------+-+------ -------+-------------------------------+
235
+ +---------------+-+-+-+-+ -------+-------------------------------+
236
+ | Version |I|B|E|C| Resvd | Frame Type = RESPONSE |
237
+ +---------------+-+-+-+-+ -------+-------------------------------+
287
238
| Stream ID |
288
239
| |
289
240
+---------------------------------------------------------------+
290
- | Header |
291
- +---------------------------------------------------------------+
292
- | Header |
293
- +---------------------------------------------------------------+
294
- | ... |
295
- +---------------------------------------------------------------+
296
- | Header |
297
- +---------------------------------------------------------------+
241
+ Response Data
298
242
```
299
243
300
- RESPONSE frames have a chain of headers that contains payload.
301
-
302
- #### Next Header
244
+ 1 . Flag Fragment Information:
245
+ 1 . __ Begin Bit__ : bit to indicate beginning of a fragmented response.
246
+ 1 . __ End Bit__ : bit to indicate end of a fragmented response.
247
+ 1 . __ Complete Bit__ : bit to indicate COMPLETE.
248
+ 1 . __ Response Data__ : payload for onNext.
303
249
304
- Contents
305
-
306
- 1 . 1 Byte Fragment Information:
307
- 1 . __ Begin Bit__ : bit to indicate beginning of a fragmented element.
308
- 1 . __ End Bit__ : bit to indicate end of a fragmented element.
309
- 1 . __ Header Data__ : payload for onNext.
310
-
311
- ```
312
- 0 1 2 3
313
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
314
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
315
- | Type |I| Header Length |
316
- +-+-+-----------+-+---------------------------------------------+
317
- |B|E| Reserved | Header Data (Depends on Type) ...
318
- +-+-+-----------+
319
- ```
250
+ A Response is general referred to as a NEXT.
320
251
321
- #### Error Header
252
+ A Response with the Complete Bit set is referred to as a COMPLETE.
322
253
323
- Contents
254
+ #### Error Frame
324
255
325
- 1 . __ Header Data__ : error information.
326
-
327
- ```
328
- 0 1 2 3
329
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
330
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
331
- | Type |I| Header Length |
332
- +-+-+-----------+-+---------------------------------------------+
333
- Header Data
334
- ```
335
-
336
- #### Complete Header
337
-
338
- Contents
339
-
340
- ```
341
- 0 1 2 3
342
- 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
343
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
344
- | Type |I| Header Length |
345
- +-+-+-----------+-+---------------------------------------------+
346
- ```
347
-
348
- #### Extension Header
256
+ Frame Contents
349
257
350
258
```
351
259
0 1 2 3
352
260
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
353
261
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354
- | 0xFF |I| Extended Type |
355
- +---------------+-+---------------------------------------------+
356
- | Header Length |
262
+ |R| Frame Length (for TCP only) |
263
+ +---------------+-+-------------+-------------------------------+
264
+ | Version |I| Reserved | Frame Type = ERROR |
265
+ +---------------+-+-------------+-------------------------------+
266
+ | Stream ID |
267
+ | |
357
268
+---------------------------------------------------------------+
358
- Depends on Extended Type...
269
+ Error Data
359
270
```
360
271
361
- * __ Frame Type__ : (8) 0xFF for Extension Header.
362
- * __ Flags__ :
363
- * (__ I__ )gnore: Can be ignored.
364
- * __ Extended Type__ : Extended type information
272
+ 1 . __ Error Data__ : error information.
273
+
274
+ An ERROR frame is used for dual purposes:
275
+ * As a means for a server to reject a SETUP frame.
276
+ * As a means of communicating a stream ERROR from a Responder to a Requester.
365
277
366
278
### Extension Frame
367
279
@@ -439,17 +351,17 @@ In the section below, "*" refers to 0 or more and "+" refers to 1 or more.
439
351
### Request Response
440
352
441
353
1 . RQ -> RS: REQUEST_RESPONSE
442
- 1 . RS -> RQ: RESPONSE with NEXT and COMPLETE
354
+ 1 . RS -> RQ: RESPONSE with COMPLETE
443
355
444
356
or
445
357
446
358
1 . RQ -> RS: REQUEST_RESPONSE
447
- 1 . RS -> RQ: RESPONSE with ERROR
359
+ 1 . RS -> RQ: ERROR
448
360
449
361
or
450
362
451
363
1 . RQ -> RS: REQUEST_RESPONSE
452
- 1 . RQ -> RS: RESPONSE with CANCEL
364
+ 1 . RQ -> RS: CANCEL
453
365
454
366
Upon sending a response, the stream is terminated on the Responder.
455
367
@@ -472,19 +384,19 @@ REQUEST_FNF are assumed to be best effort and MAY not be processed due to: (1) S
472
384
### Request Stream
473
385
474
386
1 . RQ -> RS: REQUEST_STREAM
475
- 1 . RS -> RQ: RESPONSE with 0 or more NEXTs
476
- 1 . RS -> RQ: RESPONSE with ERROR
387
+ 1 . RS -> RQ: RESPONSE*
388
+ 1 . RS -> RQ: ERROR
477
389
478
390
or
479
391
480
392
1 . RQ -> RS: REQUEST_STREAM
481
- 1 . RS -> RQ: RESPONSE with 1 or more NEXTs
393
+ 1 . RS -> RQ: RESPONSE*
482
394
1 . RS -> RQ: RESPONSE with COMPLETE
483
395
484
396
or
485
397
486
398
1 . RQ -> RS: REQUEST_STREAM
487
- 1 . RS -> RQ: RESPONSE with 0 or more NEXTs
399
+ 1 . RS -> RQ: RESPONSE*
488
400
1 . RQ -> RS: CANCEL
489
401
490
402
At any time, a client may send REQUEST_N frames.
@@ -500,18 +412,18 @@ Upon sending a COMPLETE or ERROR, the stream is terminated on the Responder.
500
412
### Request Subscription
501
413
502
414
1 . RQ -> RS: REQUEST_SUBSCRIPTION
503
- 1 . RS -> RQ: RESPONSE with 0 or more NEXTs
415
+ 1 . RS -> RQ: RESPONSE*
504
416
505
417
or
506
418
507
419
1 . RQ -> RS: REQUEST_SUBSCRIPTION
508
- 1 . RS -> RQ: RESPONSE with 0 or more NEXTs
509
- 1 . RS -> RQ: RESPONSE with ERROR
420
+ 1 . RS -> RQ: RESPONSE*
421
+ 1 . RS -> RQ: ERROR
510
422
511
423
or
512
424
513
425
1 . RQ -> RS: REQUEST_SUBSCRIPTION
514
- 1 . RS -> RQ: RESPONSE with 0 or more NEXTs
426
+ 1 . RS -> RQ: RESPONSE*
515
427
1 . RQ -> RS: CANCEL
516
428
517
429
At any time, a client may send REQUEST_N frames.
@@ -536,7 +448,7 @@ Upon sending a ERROR, the stream is terminated on the Responder.
536
448
#### Responder
537
449
538
450
1 . CLOSED: implicit starting/ending state of all stream IDs
539
- 1 . Responding: sending NEXTs and processing REQUEST_N
451
+ 1 . Responding: sending RESPONSEs and processing REQUEST_N
540
452
1 . CLOSED (received CANCEL)
541
453
1 . CLOSED (sent COMPLETE or received REQUEST_FNF)
542
454
1 . CLOSED (sent ERROR)
@@ -547,6 +459,10 @@ Upon sending a ERROR, the stream is terminated on the Responder.
547
459
* Should StreamIDs be timedout after inactivity?
548
460
* if so, need keepalive semantics
549
461
462
+ ### ChangeLog
463
+
464
+ 1 . Removed usage of header chains to discourage frames from being too large.
465
+
550
466
### TODO
551
467
552
468
1 . REQUEST_N needs to return point in stream in some way. Or even a new header type REQUEST_N_POSITIONED, or POSITION header, e.g.
@@ -556,9 +472,4 @@ Upon sending a ERROR, the stream is terminated on the Responder.
556
472
* Responder instance
557
473
1 . Exlicit METADATA header needed?
558
474
* need metadata semantics
559
- 1 . Explore
560
- * RESPONSE Frame
561
- * remove header type and bring BE flags byte into header type location. Keep length.
562
- * remove COMPLETE and add C bit to NEXT (COMPLETE is a NEXT header with C bit set and no data)
563
- * remove ERROR and add R bit to NEXT (ERROR is a NEXT header with R bit set and optionally data)
564
- * keep extension header and add 0xF after BECR flags to extend to new types.
475
+ 1 . Handling the unexpected questions
0 commit comments