Chromium Code Reviews| Index: pkg/analyzer_plugin/lib/channel/channel.dart |
| diff --git a/pkg/analyzer_plugin/lib/channel/channel.dart b/pkg/analyzer_plugin/lib/channel/channel.dart |
| index 44f065efea583a7cd1ed2a5f6be41db134cd6be6..0d385e4f6c55df5e71de767d1c00dcdbd1de8214 100644 |
| --- a/pkg/analyzer_plugin/lib/channel/channel.dart |
| +++ b/pkg/analyzer_plugin/lib/channel/channel.dart |
| @@ -5,8 +5,9 @@ |
| import 'package:analyzer_plugin/protocol/protocol.dart'; |
| /** |
| - * The object that allows a [ServerPlugin] to receive [Request]s and to return |
| - * both [Response]s and [Notification]s. |
| + * A communication channel that allows a [ServerPlugin] to receive [Request]s |
| + * from, and to return both [Response]s and [Notification]s to, an analysis |
| + * server. |
| * |
| * Clients may not extend, implement or mix-in this class. |
| */ |
| @@ -36,3 +37,33 @@ abstract class PluginCommunicationChannel { |
| */ |
| void sendResponse(Response response); |
| } |
| + |
| +/** |
| + * A communication channel that allows an analysis server to send [Request]s |
| + * to, and to receive both [Response]s and [Notification]s from, a plugin. |
| + * |
| + * Clients may not extend, implement or mix-in this class. |
| + */ |
| +abstract class ServerCommunicationChannel { |
| + /** |
| + * Close the communication channel. |
| + */ |
| + void close(); |
| + |
| + /** |
| + * Listen to the channel for responses and notifications. If a response is |
| + * received, invoke the [onResponse] function. If a notification is received, |
| + * invoke the [onNotification] function. If an error is encountered while |
| + * trying to read from the socket, invoke the [onError] function. If the |
| + * socket is closed by the client, invoke the [onDone] function. Only one |
|
scheglov
2017/02/02 18:25:04
Is "the client" here code that uses ServerCommunic
Brian Wilkerson
2017/02/02 18:46:39
The plugin. I'll fix the wording, thanks.
|
| + * listener is allowed per channel. |
| + */ |
| + void listen(void onResponse(Response response), |
| + void onNotification(Notification notification), |
| + {Function onError, void onDone()}); |
| + |
| + /** |
| + * Send the given [request] to the plugin. |
| + */ |
| + void sendRequest(Request request); |
| +} |