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

Optimize message format #887

Closed
davidfowl opened this issue Oct 30, 2012 · 4 comments
Closed

Optimize message format #887

davidfowl opened this issue Oct 30, 2012 · 4 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

This is our message format today.

{"MessageId":"Microsoft.AspNet.SignalR.Samples.Raw.RawConnection,0000000000000001|6d3dbbf4-71d2-4e1e-9930-783670e5ce57,0000000000000001|ACK_6d3dbbf4-71d2-4e1e-9930-783670e5ce57,0000000000000000|Microsoft.AspNet.SignalR.Samples.Raw.RawConnection.foo,0000000000000000","Disconnect":false,"TimedOut":false,"TransportData":{"Groups":["Microsoft.AspNet.SignalR.Samples.Raw.RawConnection.foo"]},"Messages":[{"type":"Broadcast","from":"6d3dbbf4-71d2-4e1e-9930-783670e5ce57","data":""}]}
#859 will reduce the size of the cursor significantly. We can make this better by changing the name of the fields to be single characters.

This is a protocol change so all clients will break.

@ghost ghost assigned halter73 Oct 30, 2012
@NTaylorMullen
Copy link
Contributor

+1

1 similar comment
@MosheL
Copy link

MosheL commented Nov 1, 2012

+1

@halter73
Copy link
Member

halter73 commented Nov 2, 2012

Old
{"MessageId":"B,2CE|K,C|L,2|M,0|I,0|J,0","Disconnect":false,"TimedOut":false,"TransportData":{"Groups":["demo.foo","demo.bar"]},"Messages":[{"Hub":"demo","Method":"fromArbitraryCode","Args":["11/1/2012 7:54:17 PM"],"State":null}]}

New

Hubs
{"C":"B,2CE|K,C|L,2|M,0|I,0|J,0","M":[{"H":"demo","M":"fromArbitraryCode","A":["11/1/2012 7:54:17 PM"]}]}
{"C":"B,2CE|K,C|L,2|M,0|I,0|J,0","G":["demo.foo"],"g":["demo.bar"],"T":1,"M":[{"H":"demo","M":"fromArbitraryCode","A":["11/1/2012 7:54:17 PM"]}]}

Hub Payloads (Old)
{"hub":"dashboard","method":"SetBroadcastSize","args":[32],"state":{},"id":2}
{"State":{},"Result":null,"Id":"2","Error":null,"StackTrace":null}
{"State":{},"Result":{"ConnectionBehavior":0,"BroadcastBatching":false,"BroadcastCount":2,"BroadcastSeconds":1,"BroadcastSize":32,"Broadcasting":true,"ServerFps":2},"Id":"0","Error":null,"StackTrace":null}

Hub Payloads (New)
{"H":"dashboard","M":"SetBroadcastSize","A":[32],"S":{"x":1},"I":2}
{"H":"dashboard","M":"SetBroadcastSize","A":[32],"I":2} -> No state

{"R":{"ConnectionBehavior":0,"BroadcastBatching":false,"BroadcastCount":2,"BroadcastSeconds":1,"BroadcastSize":32,"Broadcasting":true,"ServerFps":2},"I":"0"}
{"I": 0}  -> no result
{"I": 0, "S":{"x":1},"R":1} -> result
{"I": 0, "E":"This is an error" } -> error
{"I": 0, "E":"This is an error", "T": "Some stack trace here" } -> error and stack

PersistentConnections
{"C":"B,2CE|K,C|L,2|M,0|I,0|J,0","M":["foo"]}

Persistent Response:
C - cursor
M - Messages
T - Timeout (only if true) value is 1
D - Disconnect (only if true) value is 1
R - All Groups (Client groups should be reset to match this list exactly)
G - Groups added
g - Groups removed

Hub message:
H - Hub name
M - method name
A - arguments
S - state (if not null)

Hub Method Return:
I - index
R - result
S - state
E - error
T - stack trace

@Xiaohongt
Copy link
Contributor

verified

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

No branches or pull requests

5 participants