| OLD | NEW |
| (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 } |
| OLD | NEW |