Open lukepighetti opened 3 years ago
This was cross posted from https://github.com/MichaelMarner/dart-redux-remote-devtools/issues/35, which has been closed because the issue is upstream in socketcluster_client
I tried wrapping the web WebSocket
creation with this, making sure to await the builder method, but I still can't get it to error cleanly. If I put this same exact code in my Flutter main()
method, it will error cleanly. No idea what's going on inside this package to cause this difference.
final completer = Completer();
final ws = WebSocket(url);
ws.onError.listen((e) {
print('onError $e');
completer.complete();
});
ws.onOpen.listen((e) {
print('onOpen $e');
completer.complete();
});
await completer.future;
return ws;
I don't use Flutter on web so don't have much experience here. But do you get a stacktrace where the error is occuring (ie what's in the exception in the devtools if you expand it)?
I get nothing useful out of any of the normal flutter tooling, unfortunately.
This package is upstream of redux_remote_dev_tools
and the result is that on web if we try to connect to dev tools and the server is not up, the app hard crashes and won't launch. This problem doesn't exist on any other platform, where the failure to connect is easily caught by a try/catch block.
Description
If you try to connect to a websocket server that isn't available on flutter web the app violently crashes even if you try to catch the error.
flutter --version
Reproduction
ws://localhost:8000/foo
Expected Results
Actual Results
Error State
MCVE