Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to work due to SocketException #5

Open
TobiasHeidingsfeld opened this issue Oct 3, 2019 · 3 comments · May be fixed by #7
Open

Fails to work due to SocketException #5

TobiasHeidingsfeld opened this issue Oct 3, 2019 · 3 comments · May be fixed by #7

Comments

@TobiasHeidingsfeld
Copy link

When running with

final reloader = new HotReloader();
reloader.addPath('.');
await reloader.go();

with --enable-vm-service=1 args the following error occures:

Exception has occurred.
SocketException (SocketException: OS Error: The remote computer refused the network connection.
, errno = 1225, address = localhost, port = 54394)

@TobiasHeidingsfeld
Copy link
Author

It seems --enable-vm-service=8181 should do as this is the port that is hard coded but it also fails with the same error

@renatoathaydes
Copy link

Same problem for me on Ubuntu:

Paths ./bin/server.dart changed!
Reloading the application...
Unhandled exception:
SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 49406
#0      vmServiceConnectUri (package:vm_service_lib/vm_service_lib_io.dart:20:22)
<asynchronous suspension>
#1      HotReloader.reload (package:jaguar_hotreload/src/jaguar_hotreload_base.dart:350:23)
<asynchronous suspension>
#2      new HotReloader.<anonymous closure> (package:jaguar_hotreload/src/jaguar_hotreload_base.dart:124:13)
<asynchronous suspension>
....

It works when I use this snippet (posted by @mindplay-dk on gitter) instead of the one shown in this lib's docs:

  if (HotReloader.isHotReloadable) {
    var info = await dev.Service.getInfo();
    var uri = info.serverUri;
    uri = uri.replace(path: path.join(uri.path, 'ws'));
    if (uri.scheme == 'https') {
      uri = uri.replace(scheme: 'wss');
    } else {
      uri = uri.replace(scheme: 'ws');
    }

    print('Hot reloading enabled');
    final reloader = HotReloader(vmServiceUrl: uri.toString());
    await reloader.addPath('.');
    await reloader.go();
  }

@tejainece
Copy link
Member

Please submit a PR.

@mindplay-dk mindplay-dk linked a pull request Nov 17, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants