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

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

Issue 340443006: Add support for asynchronous event notification to the observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | runtime/vm/debugger.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
11 final WebSocket socket; 11 final WebSocket socket;
12 12
13 WebSocketClient(this.socket, service) : super(service) { 13 WebSocketClient(this.socket, service) : super(service) {
14 socket.listen((message) => onWebSocketMessage(message)); 14 socket.listen((message) => onWebSocketMessage(message));
15 socket.done.then((_) => close()); 15 socket.done.then((_) => close());
16 service.subscribe('debug', this);
16 } 17 }
17 18
18 void onWebSocketMessage(message) { 19 void onWebSocketMessage(message) {
19 if (message is String) { 20 if (message is String) {
20 var map; 21 var map;
21 try { 22 try {
22 map = JSON.decode(message); 23 map = JSON.decode(message);
23 } catch (e) { 24 } catch (e) {
24 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e'); 25 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e');
25 return; 26 return;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 _server = null; 192 _server = null;
192 return this; 193 return this;
193 }).catchError((e, st) { 194 }).catchError((e, st) {
194 _server = null; 195 _server = null;
195 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); 196 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
196 return this; 197 return this;
197 }); 198 });
198 } 199 }
199 200
200 } 201 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/service/object.dart ('k') | runtime/vm/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698