File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ These methods can be registered using `Server.registerMethod`:
10
10
``` dart
11
11
import "package:json_rpc_2/json_rpc_2.dart" as json_rpc;
12
12
import "package:stream_channel/stream_channel.dart";
13
+ import "package:web_socket_channel/io.dart";
13
14
14
15
main() async {
15
- var socket = await WebSocket .connect('ws://localhost:4321');
16
- var server = new json_rpc.Server(new StreamChannel( socket, socket) );
16
+ var socket = IOWebSocketChannel .connect('ws://localhost:4321');
17
+ var server = new json_rpc.Server(socket);
17
18
18
19
// Any string may be used as a method name. JSON-RPC 2.0 methods are
19
20
// case-sensitive.
@@ -81,10 +82,11 @@ responses to those method calls. These methods can be called using
81
82
``` dart
82
83
import "package:json_rpc_2/json_rpc_2.dart" as json_rpc;
83
84
import "package:stream_channel/stream_channel.dart";
85
+ import "package:web_socket_channel/html.dart";
84
86
85
87
main() async {
86
- var socket = await WebSocket .connect('ws://localhost:4321');
87
- var client = new json_rpc.Client(new StreamChannel( socket, socket) );
88
+ var socket = HtmlWebSocketChannel .connect('ws://localhost:4321');
89
+ var client = new json_rpc.Client(socket);
88
90
89
91
// This calls the "count" method on the server. A Future is returned that
90
92
// will complete to the value contained in the server's response.
You can’t perform that action at this time.
0 commit comments