DescriptionDo not JSON encode the 'result' of a service rpc.
Before a response looked like this...
{ result:<string> id:* }
...where result was always a json encoded string. This meant that
users of the service protocol had to json decode both the outer
message and the result, which was silly.
Now a response looks like this:
{ result:<map> id:* }
This means that users of the service protocol only need to decode once.
We have changed event formats as well. Previously, an event looked like this:
{ result:<string> }
(Essentially a result without an id.) The result was json encoded,
requiring the user to double-decode.
Now an event looks like this:
{ event:<map> }
This allows us to distinguish events from rpc results and avoids
double-decoding. It also avoids having an id-less rpc result mistaken
for an event.
------------
Some details and associated changes:
- Unify GCEvent and ServiceEvent in the VM.
- Move sequence number handling out of dart code and into JSONStream
in the VM. Plumbing. I needed to do this to avoid double-encoding.
Some of the dart code gets a bit simpler.
- Update C++ tests to have a sequence number.
- Change format of method/params used in Error responses to be more json-y.
- Strip out double decoding in the service lib.
- Improvements to tests. I was running into some races and other issues.
- Fail fast when we run into a message decoding problem. Instead of
returning a service exception, we now disconnect from the vm.
- VMDisconnected => ConnectionClosed.
- Add some support for a reason string when disconnecting from the vm
in the service library.
Committed: https://code.google.com/p/dart/source/detail?r=45378
Patch Set 1 #Patch Set 2 : edits #
Total comments: 4
Patch Set 3 : fixes after merge #Patch Set 4 : code review #
Messages
Total messages: 5 (1 generated)
|