Coder Social home page Coder Social logo

Comments (3)

bverhagen avatar bverhagen commented on June 30, 2024

I just realized that, around the same time, I switched on fatal and async error recording for Firebase Crashlytics (which may explain why I did not see this happen with hasura_connect):

FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;

PlatformDispatcher.instance.onError = (error, stack) {
  FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
  return true;
};

I assume it is the async error recording that is the culprit here. Still, is there a way to catch it?

from gql.

bverhagen avatar bverhagen commented on June 30, 2024

In the meantime I found this: dart-lang/web_socket_channel#38.

I am going to test whether the suggested solution of awaiting socket.ready will allow me to catch the error in the channelGenerator callback.

from gql.

bverhagen avatar bverhagen commented on June 30, 2024

Preliminary testing seems to indicate this fixes it for initial connection errors:

channelGenerator: () async {
        while (true) {
          final socket = WebSocketChannel.connect(
              Uri.parse("wss://$apiDomain/v1/graphql"));
          try {
            await socket.ready;
            developer
                .log("Successfully connected with websocket to '$apiDomain'!");
            return socket;
          } catch (e, stacktrace) {
            developer.log("Error connecting to websocket: $e");
            await Future.delayed(const Duration(seconds: 5));
          }
        }
      }

Shouldn't the default channelGenerator be robust against this to?

Additionally, returning the errored socket, also results in an uncaught async error later on in its usage.

from gql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.