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

Unified Diff: README.md

Issue 1780583002: Use web_socket_channel in the README. (Closed) Base URL: git@github.com:dart-lang/json_rpc_2.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: README.md
diff --git a/README.md b/README.md
index 8078fa273fd140b34eee1ac98a14fb246baa5e10..e4952640400cea7d02112a0f9da8600f46bc7a61 100644
--- a/README.md
+++ b/README.md
@@ -10,10 +10,11 @@ These methods can be registered using `Server.registerMethod`:
```dart
import "package:json_rpc_2/json_rpc_2.dart" as json_rpc;
import "package:stream_channel/stream_channel.dart";
+import "package:web_socket_channel/io.dart";
main() async {
- var socket = await WebSocket.connect('ws://localhost:4321');
- var server = new json_rpc.Server(new StreamChannel(socket, socket));
+ var socket = IOWebSocketChannel.connect('ws://localhost:4321');
+ var server = new json_rpc.Server(socket);
// Any string may be used as a method name. JSON-RPC 2.0 methods are
// case-sensitive.
@@ -81,10 +82,11 @@ responses to those method calls. These methods can be called using
```dart
import "package:json_rpc_2/json_rpc_2.dart" as json_rpc;
import "package:stream_channel/stream_channel.dart";
+import "package:web_socket_channel/html.dart";
main() async {
- var socket = await WebSocket.connect('ws://localhost:4321');
- var client = new json_rpc.Client(new StreamChannel(socket, socket));
+ var socket = HtmlWebSocketChannel.connect('ws://localhost:4321');
+ var client = new json_rpc.Client(socket);
// This calls the "count" method on the server. A Future is returned that
// will complete to the value contained in the server's response.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698