Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol parser #3

Closed
tshemsedinov opened this issue Apr 17, 2018 · 1 comment
Closed

Protocol parser #3

tshemsedinov opened this issue Apr 17, 2018 · 1 comment
Assignees

Comments

@tshemsedinov
Copy link
Member

tshemsedinov commented Apr 17, 2018

Network transmission structures:

Handshake

- version: 2b
- status: 1b
  - 0 = new connection (from client)
  - 1 = restore connection (from client)
  - 2 = accept connection (from server)
  - 3 = reject connection (from server)
- reserved: 1b
- token: 32b (optional), token contains id (bit prefix)

Parcel

- structType: 1b
  - parcel = 0
- parcelId: 4b
  - client++, server--
- parcelType: 1b
  - ping = 0, pong = 1, call = 2, callback = 3,
  - event = 4, stream = 5
- compression: 1b
  - no = 0, gzip = 1
- encoding: 1b
  - binary = 0, jstp = 1, json = 2, bson = 3, v8 = 4
- length: 8b

Chunk

- structType: 1b
  - chunk = 1
- parcelId: 4b
- chunkId: 4b
  - client++, server--
- flags: 1b
  - more = 1
  - stop = 2
  - pause = 4
  - resume = 8
- length: 2b
- payload: length

Client/Server dialog example

C: 0001 00 (handshake, new session request)
S: 0001 00 D16A...2A75 (handshake, token)
C: 00 00000000 00 00 00 (ping parcel)
S: 00 00000000 01 00 00 (pong parcel)
C: 00 00000001 02 00 02 0000000000000035 (call parcel)
C: 01 00000001 00000000 01 001C ["applicationName","methodNa (chunk)
C: 01 00000001 00000001 00 0019 me","par1","par2","par3"] (chunk)
S: 00 00000001 03 00 02 000000000000000A (callback parcel)
S: 01 00000001 00000002 00 00 0A ["result"] (chunk)

Parsed from chunks
["applicationName","methodName","par1","par2","par3"]

This was referenced Apr 24, 2018
o-rumiantsev pushed a commit to Tariod/metacom that referenced this issue Nov 26, 2018
* node version to ^10.0.0
* use bigint, PR-URL: metarhia#35
* tests for parser, bigint-buffer

Closes: metarhia#3
o-rumiantsev pushed a commit to Tariod/metacom that referenced this issue Sep 20, 2019
* node version to ^10.0.0
* use bigint, PR-URL: metarhia#35
* tests for parser, bigint-buffer

Closes: metarhia#3
@tshemsedinov
Copy link
Member Author

Closed in favour of new version 0.1.x implementing new specification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants