Closed GGGuenni closed 1 year ago
I'm running on flutter web and using RiverPod
This error is spammed a few times when hot restarting/reloading or refreshing the page
Initialising connection Got object store box in database graphqlclientstore. --- Hot Restart happens here --- Initialising connection [SocketClient] message stream encountered error: WebSocketChannelException: WebSocket connection failed. stacktrace: Disconnected from websocket. Error: WebSocketChannelException: WebSocket connection failed. C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 299:10 createErrorWithStack C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 355:28 _throw C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/core/errors.dart 120:5 throwWithStackTrace C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1385:11 callback C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 166:15 <fn>
Any idea what could be causing this?
I'm running on flutter web and using RiverPod
The GraphQLClient
```dart final gqlWebsocketClientProvider = Provider
Usage
```dart class AssetsNotifier extends ChangeNotifier { final Ref ref; late final GraphQLClient _wsClient = ref.read(gqlWebsocketClientProvider); late final Stream
?> _stream; late final StreamSubscription _subscription; OperationException? _exception; List? _assets;
AssetsNotifier(this.ref) {
final SubscriptionOptions options = SubscriptionOptions(
document: gql(_assetsSubscription),
);
_stream = _wsClient.subscribe(options).map(
(event) {
if (event.hasException) {
_exception = event.exception;
return null;
}
return (event.data)?.map((e) => Asset.fromJson(e)).toList();
},
);
_subscription = _stream.listen((event) {
_assets = event;
notifyListeners();
});
ref.onDispose(() {
_subscription.cancel();
});
}
}
```
This error is spammed a few times when hot restarting/reloading or refreshing the page
Any idea what could be causing this?