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

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

Issue 112223002: WebSocket client for VM service (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of vmservice;
6
7 // A service client.
8 abstract class Client {
9 final RawReceivePort receivePort = new RawReceivePort();
10 final VMService service;
11
12 Client(this.service) {
13 receivePort.handler = (response) {
14 post(response);
15 };
16 service.addClient(this);
17 }
18
19 // Call when the client is closing the connection.
20 void close() {
21 service.removeClient(this);
22 }
23
24 // Call to process a message from the client.
25 void onMessage(var message) {
26 // Call post when the response arrives.
27 message.future.then(post);
28 // Send message to service.
29 service.route(message);
30 }
31
32 // Responsible for sending [response] to the client.
33 void post(var response);
34
35 Map toJson() {
36 return {
37 };
38 }
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698