dart-websocket icon indicating copy to clipboard operation
dart-websocket copied to clipboard

It can't run in Chrome

Open GreatGreatGreg opened this issue 5 years ago • 5 comments

flutter run -d chrome

Flutter 1.10.7 • channel dev • https://github.com/flutter/flutter.git Framework • revision e70236e36c (17 hours ago) • 2019-10-02 09:32:30 -0700 Engine • revision 9e6314d348 Tools • Dart 2.6.0 (build 2.6.0-dev.0.0 1103600280)

======================

Launching lib/main.dart on Chrome in debug mode... Building application for the web... Throwing away cached asset graph because the build phases have changed. This most commonly would happen as a result of adding a new dependency or updating your dependencies. Skipping compiling nb|lib/main_web_entrypoint.dart with ddc because some of its transitive libraries have sdk dependencies that not supported on this platform:

import 'package:websocket/websocket.dart';

https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-skipped-compiling-warnings

Attempting to connect to browser instance..

GreatGreatGreg avatar Oct 04 '19 03:10 GreatGreatGreg

Thanks for reporting, im travelling, thus it might take me awhile to look at it

truongsinh avatar Oct 04 '19 12:10 truongsinh

Fixed. It works after I switch to the latest master branch. Appreciate it

https://github.com/flutter/flutter/issues/42228

GreatGreatGreg avatar Oct 09 '19 01:10 GreatGreatGreg

It works in Flutter for IOS and Flutter web. But it is not working in Flutter for Android.

try { this.socket = await WebSocket.connect(WsUrl); } catch (e) { print(e) }

got this: OS Error: Connection refused, errno = 111, address = localhost, port = 54895

what can I do now? Thanks

GreatGreatGreg avatar Oct 13 '19 12:10 GreatGreatGreg

@greatGregLiu I doubt it's the server part (as the error says, "connection refused"). Please try to set WsUrl = "wss://echo.websocket.org" first to see whether it can connect to this referential implementation. Also, what WS server are using.

truongsinh avatar Oct 16 '19 14:10 truongsinh

@greatGregLiu I doubt it's the server part (as the error says, "connection refused"). Please try to set WsUrl = "wss://echo.websocket.org" first to see whether it can connect to this referential implementation. Also, what WS server are using.

thanks. It works. In android emulator, it points to localhost which is not what I wanted and this is the reason that does not work

GreatGreatGreg avatar Mar 04 '20 02:03 GreatGreatGreg