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

Side by Side Diff: runtime/bin/vmservice/server.dart

Issue 305603004: Observatory now uses websockets to communicate with the vm. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of vmservice_io; 5 part of vmservice_io;
6 6
7 class WebSocketClient extends Client { 7 class WebSocketClient extends Client {
8 static const int PARSE_ERROR_CODE = 4000; 8 static const int PARSE_ERROR_CODE = 4000;
9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001;
10 static const int NOT_MAP_ERROR_CODE = 4002; 10 static const int NOT_MAP_ERROR_CODE = 4002;
(...skipping 11 matching lines...) Expand all
22 map = JSON.decode(message); 22 map = JSON.decode(message);
23 } catch (e) { 23 } catch (e) {
24 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e'); 24 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e');
25 return; 25 return;
26 } 26 }
27 if (map is! Map) { 27 if (map is! Map) {
28 socket.close(NOT_MAP_ERROR_CODE, 'Message must be a JSON map.'); 28 socket.close(NOT_MAP_ERROR_CODE, 'Message must be a JSON map.');
29 return; 29 return;
30 } 30 }
31 var seq = map['seq']; 31 var seq = map['seq'];
32 onMessage(seq, new Message.fromMap(map)); 32 onMessage(seq, new Message.fromUri(Uri.parse(map['request'])));
33 } else { 33 } else {
34 socket.close(BINARY_MESSAGE_ERROR_CODE, 'message must be a string.'); 34 socket.close(BINARY_MESSAGE_ERROR_CODE, 'Message must be a string.');
35 } 35 }
36 } 36 }
37 37
38 void post(var seq, String response) { 38 void post(var seq, String response) {
39 try { 39 try {
40 Map map = { 40 Map map = {
41 'seq': seq, 41 'seq': seq,
42 'response': response 42 'response': response
43 }; 43 };
44 socket.add(JSON.encode(map)); 44 socket.add(JSON.encode(map));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 port = s.port; 126 port = s.port;
127 _server = s; 127 _server = s;
128 _server.listen(_requestHandler); 128 _server.listen(_requestHandler);
129 if (display_message) { 129 if (display_message) {
130 print('Observatory listening on http://$ip:$port'); 130 print('Observatory listening on http://$ip:$port');
131 } 131 }
132 return s; 132 return s;
133 }); 133 });
134 } 134 }
135 } 135 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/app/application.dart ('k') | tests/standalone/vmservice/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698