Skip to content

Commit

Permalink
Use web_socket_channel in the README.
Browse files Browse the repository at this point in the history
Closes dart-lang/json_rpc_2#8

R=tjblasi@google.com

Review URL: https://codereview.chromium.org//1780583002 .
  • Loading branch information
nex3 committed Mar 9, 2016
1 parent 0c69288 commit 26f649e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkgs/json_rpc_2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 26f649e

Please sign in to comment.