Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: runtime/bin/vmservice/server.dart

Issue 823403004: Begin migrating the vm service from a rest-style interface to a json-rpc style interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove old-style standalone tests. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/vmservice/vmservice_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/server.dart
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 17512580d5e0738c717910b532109fa75c9b51c8..46cff7b8ba1cc8ba302d62f5e556accb2debb574 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -30,20 +30,29 @@ class WebSocketClient extends Client {
socket.close(NOT_MAP_ERROR_CODE, 'Message must be a JSON map.');
return;
}
- var seq = map['seq'];
- onMessage(seq, new Message.fromUri(Uri.parse(map['request'])));
+ var serial = map['id'];
+
+ // If the map contains 'params' then this is a JsonRPC message.
+ // We are currently in the process of switching the vmservice over to
+ // JsonRPC.
+ if (map['params'] != null) {
+ onMessage(serial, new Message.fromJsonRpc(map['method'],
+ map['params']));
+ } else {
+ onMessage(serial, new Message.fromUri(Uri.parse(map['method'])));
+ }
} else {
socket.close(BINARY_MESSAGE_ERROR_CODE, 'Message must be a string.');
}
}
- void post(var seq, dynamic response) {
+ void post(var serial, dynamic response) {
try {
Map map = {
- 'seq': seq,
+ 'id': serial,
'response': response
};
- if (seq == null && response is! String) {
+ if (serial == null && response is! String) {
socket.add(response);
} else {
socket.add(JSON.encode(map));
@@ -69,7 +78,7 @@ class HttpRequestClient extends Client {
HttpRequestClient(this.request, service) : super(service);
- void post(var seq, String response) {
+ void post(var serial, String response) {
request.response..headers.contentType = jsonContentType
..write(response)
..close();
« no previous file with comments | « no previous file | runtime/bin/vmservice/vmservice_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698