| Index: runtime/bin/vmservice/client.dart
|
| diff --git a/runtime/bin/vmservice/client.dart b/runtime/bin/vmservice/client.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2e42ae571b45b5495cc7045b6c75b43edec78a4d
|
| --- /dev/null
|
| +++ b/runtime/bin/vmservice/client.dart
|
| @@ -0,0 +1,39 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +part of vmservice;
|
| +
|
| +// A service client.
|
| +abstract class Client {
|
| + final RawReceivePort receivePort = new RawReceivePort();
|
| + final VMService service;
|
| +
|
| + Client(this.service) {
|
| + receivePort.handler = (response) {
|
| + post(response);
|
| + };
|
| + service.addClient(this);
|
| + }
|
| +
|
| + // Call when the client is closing the connection.
|
| + void close() {
|
| + service.removeClient(this);
|
| + }
|
| +
|
| + // Call to process a message from the client.
|
| + void onMessage(var message) {
|
| + // Call post when the response arrives.
|
| + message.future.then(post);
|
| + // Send message to service.
|
| + service.route(message);
|
| + }
|
| +
|
| + // Responsible for sending [response] to the client.
|
| + void post(var response);
|
| +
|
| + Map toJson() {
|
| + return {
|
| + };
|
| + }
|
| +}
|
|
|