{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/12","repository_url":"https://api.github.com/repos/dart-lang/json_rpc_2","labels_url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/12/comments","events_url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/12/events","html_url":"https://github.com/dart-lang/json_rpc_2/issues/12","id":183438379,"number":12,"title":"WebSocketChannelException: SocketException: OS Error: The remote computer refused the network connection.","user":{"login":"rahulakash","id":6896985,"avatar_url":"https://avatars.githubusercontent.com/u/6896985?v=3","gravatar_id":"","url":"https://api.github.com/users/rahulakash","html_url":"https://github.com/rahulakash","followers_url":"https://api.github.com/users/rahulakash/followers","following_url":"https://api.github.com/users/rahulakash/following{/other_user}","gists_url":"https://api.github.com/users/rahulakash/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulakash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulakash/subscriptions","organizations_url":"https://api.github.com/users/rahulakash/orgs","repos_url":"https://api.github.com/users/rahulakash/repos","events_url":"https://api.github.com/users/rahulakash/events{/privacy}","received_events_url":"https://api.github.com/users/rahulakash/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-17T14:53:11Z","updated_at":"2016-10-17T19:44:08Z","closed_at":"2016-10-17T19:44:08Z","body":"Hello, \r\n\r\nThanks for this great library. I am trying to get started by setting up a simple example like below. \r\n\r\n\r\n```\r\nimport \"package:json_rpc_2/json_rpc_2.dart\" as json_rpc;\r\nimport \"package:stream_channel/stream_channel.dart\";\r\nimport \"package:web_socket_channel/io.dart\";\r\n\r\nmain() async {\r\nvar socket = new IOWebSocketChannel.connect('ws://localhost:8081');\r\nvar server =  new json_rpc.Server(socket);\r\nserver.registerMethod('hello',(){\r\n    return 'Hello from JSON_RPC_2';\r\n});\r\nserver.listen();\r\n}\r\n```\r\n\r\nWhen I try to run the above code, it throws:\r\n\r\n> Unhandled exception:\r\n> WebSocketChannelException: WebSocketChannelException: SocketException: OS Error: The remote computer refused the network connection.\r\n> , errno = 1225, address = localhost, port = 52488\r\n> #0      IOWebSocketChannel.IOWebSocketChannel._withoutSocket.<anonymous closure> (package:web_socket_channel/io.dart:79:13)\r\n> #1      _invokeErrorHandler (dart:async/async_error.dart:13)\r\n> #2      _HandleErrorStream._handleError (dart:async/stream_pipe.dart:298)\r\n> #3      _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:180)\r\n> #4      _RootZone.runBinaryGuarded (dart:async/zone.dart:1350)\r\n> #5      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:350)\r\n> #6      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:368)\r\n> #7      _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:267)\r\n> #8      _StreamController&&_SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:772)\r\n> #9      _StreamController._addError (dart:async/stream_controller.dart:643)\r\n> #10     _RootZone.runBinaryGuarded (dart:async/zone.dart:1350)\r\n> #11     _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:350)\r\n> #12     _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:368)\r\n> #13     _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:267)\r\n> #14     _StreamController&&_SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:772)\r\n> #15     _StreamController._addError (dart:async/stream_controller.dart:643)\r\n> #16     Stream.Stream.fromFuture.<anonymous closure> (dart:async/stream.dart:111)\r\n> #17     _RootZone.runBinary (dart:async/zone.dart:1410)\r\n> #18     _FutureListener.handleError (dart:async/future_impl.dart:146)\r\n> #19     _Future._propagateToListeners.handleError (dart:async/future_impl.dart:649)\r\n> #20     _Future._propagateToListeners (dart:async/future_impl.dart:671)\r\n> #21     _Future._completeError (dart:async/future_impl.dart:485)\r\n> #22     _Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:537)\r\n> #23     _microtaskLoop (dart:async/schedule_microtask.dart:41)\r\n> #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)\r\n> #25     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)\r\n> #26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)\r\n> \r\n> Process finished with exit code 255\r\n\r\n\r\nNote: I made sure that no other process is running on this port (8081). I also tried to run the example provided in the homepage but I am getting the same error. \r\n\r\nAny suggestion on how to resolve this issue is highly appreciated. \r\n\r\nThank you.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/comments/254312151","html_url":"https://github.com/dart-lang/json_rpc_2/issues/12#issuecomment-254312151","issue_url":"https://api.github.com/repos/dart-lang/json_rpc_2/issues/12","id":254312151,"user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T19:44:08Z","updated_at":"2016-10-17T19:44:08Z","body":"`IOWebSocketChannel.connect()` is a client connection method—there needs to be a WebSocket server listening on the port in question for the connection to work. If you want to create a WebSocket server listening on that port, you can the [`shelf_web_socket`](https://pub.dartlang.org/packages/shelf_web_socket) package."}}
{"actor":{"display_login":"nex3"}}