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

Unified Diff: pkg/analysis_server/lib/src/channel.dart

Issue 176873015: update client to use channel rather than socket (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use common json encoder Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_manager.dart ('k') | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/channel.dart
diff --git a/pkg/analysis_server/lib/src/channel.dart b/pkg/analysis_server/lib/src/channel.dart
index 103c2b77acc39d9420ab98f31e89ac446fc8c9a2..859a393f5640987c28a02bdb1904168444d71240 100644
--- a/pkg/analysis_server/lib/src/channel.dart
+++ b/pkg/analysis_server/lib/src/channel.dart
@@ -29,6 +29,11 @@ abstract class CommunicationChannel {
void sendNotification(Notification notification);
/**
+ * Send the given [request] to the server.
+ */
+ void sendRequest(Request request);
+
+ /**
* Send the given [response] to the client.
*/
void sendResponse(Response response);
@@ -44,6 +49,8 @@ class WebSocketChannel implements CommunicationChannel {
*/
final WebSocket socket;
+ final JsonEncoder jsonEncoder = const JsonEncoder(null);
+
/**
* Initialize a newly create [WebSocket] wrapper to wrap the given [socket].
*/
@@ -57,14 +64,17 @@ class WebSocketChannel implements CommunicationChannel {
@override
void sendNotification(Notification notification) {
- JsonEncoder encoder = const JsonEncoder(null);
- socket.add(encoder.convert(notification.toJson()));
+ socket.add(jsonEncoder.convert(notification.toJson()));
+ }
+
+ @override
+ void sendRequest(Request request) {
+ socket.add(jsonEncoder.convert(request.toJson()));
}
@override
void sendResponse(Response response) {
- JsonEncoder encoder = const JsonEncoder(null);
- socket.add(encoder.convert(response.toJson()));
+ socket.add(jsonEncoder.convert(response.toJson()));
}
/**
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_manager.dart ('k') | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698