OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 import 'package:analyzer_plugin/protocol/protocol.dart'; |
| 6 |
| 7 /** |
| 8 * The object that allows a [ServerPlugin] to receive [Request]s and to return |
| 9 * both [Response]s and [Notification]s. |
| 10 * |
| 11 * Clients may not extend, implement or mix-in this class. |
| 12 */ |
| 13 abstract class PluginCommunicationChannel { |
| 14 /** |
| 15 * Close the communication channel. |
| 16 */ |
| 17 void close(); |
| 18 |
| 19 /** |
| 20 * Listen to the channel for requests. If a request is received, invoke the |
| 21 * [onRequest] function. If an error is encountered while trying to read from |
| 22 * the socket, invoke the [onError] function. If the socket is closed by the |
| 23 * client, invoke the [onDone] function. Only one listener is allowed per |
| 24 * channel. |
| 25 */ |
| 26 void listen(void onRequest(Request request), |
| 27 {Function onError, void onDone()}); |
| 28 |
| 29 /** |
| 30 * Send the given [notification] to the server. |
| 31 */ |
| 32 void sendNotification(Notification notification); |
| 33 |
| 34 /** |
| 35 * Send the given [response] to the server. |
| 36 */ |
| 37 void sendResponse(Response response); |
| 38 } |
OLD | NEW |