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

Subscription stuck with state: Initialising connection #1308

Closed
vytautas-pranskunas- opened this issue Mar 14, 2023 · 14 comments · Fixed by #1309
Closed

Subscription stuck with state: Initialising connection #1308

vytautas-pranskunas- opened this issue Mar 14, 2023 · 14 comments · Fixed by #1309
Labels
dart client Issue relates mainly to the standalone dart client help wanted Extra attention is needed ⌛ reproduction needed Issue is subtle and requires a true accessible reproduction to debug Priority: Waiting to be assigned To be inside the next release process, it need to be marked with some level of priority

Comments

@vytautas-pranskunas-
Copy link
Contributor

vytautas-pranskunas- commented Mar 14, 2023

I have this code:


    final websocketLink = WebSocketLink(
      subscriptionUri,
      config: SocketClientConfig(
        autoReconnect: true,
        delayBetweenReconnectionAttempts: const Duration(seconds: 2),
        initialPayload: () {
          return authTokenService.addAuthHeader(EnvVariables.currentHost);
        },
      ),
      subProtocol: GraphQLProtocol.graphqlTransportWs,
    );

    link = Link.split(
      (request) => request.isSubscription,
      websocketLink,
      link,
    );

but subscription stuck with state: Initialising connection and no messages are comming through.
It would useful to have documentation (at least me - could not find it) or if you guys could share any possible reasons for this.

Without this i canno tmove my app to new backend which uses new protocol :(

p.s. I even reduced it to:

    final websocketLink = WebSocketLink(
      subscriptionUri,
      subProtocol: GraphQLProtocol.graphqlTransportWs,
    );

    link = Link.split(
      (request) => request.isSubscription,
      websocketLink,
      link,
    );
  }

by removing auth but result is the same....

@vincenzopalazzo
Copy link
Collaborator

mh could you please provide a reproduced with this API https://api.chat.graphql-flutter.dev/graphql

@vytautas-pranskunas-
Copy link
Contributor Author

vytautas-pranskunas- commented Mar 14, 2023

@vincenzopalazzo i have similar issue with url sandbox ou have provided.
It is quite difficult to provide reproducable code because it is quite a lot happening inside an app but could we agree that you provide working example (it should have been in documentation which not exists yet) and if it works then i can

  1. double check everything comapring to yours
  2. dig deeper for possible reason
  3. I will paste here either reproducable example or solution for other which you can include to documentation troubleshooting.

How about that?

p.s. my backend is used by WEB project and it works fine (as well as sandbox that you have provided)

@vincenzopalazzo
Copy link
Collaborator

@vytautas-pranskunas- you can check the PRs and also provide a review for it, for this reason the PR are opened

@vytautas-pranskunas-
Copy link
Contributor Author

But this is already merged... don't you have tests?
So you would not be providing working example right?
How you can be sure of it works of you b do not have working example?

@vincenzopalazzo
Copy link
Collaborator

vincenzopalazzo commented Mar 15, 2023

How you can be sure of it works of you b do not have working example?

I told you already, check the PR #1204 to the the example and maybe review it, so I can apply the suggestion and merge it

@vytautas-pranskunas-
Copy link
Contributor Author

vytautas-pranskunas- commented Mar 15, 2023

@vincenzopalazzo
I have tested even further and what i have found that i was confused by that message: I/flutter ( 4558): Initialising connection because messages are received just message is wrong it should be Connected to websocket

@vincenzopalazzo
Copy link
Collaborator

For this reason, reproduction is needed when someone submits an issue!

Regarding the log message I will have a better solution to trace the library with #1207

@vytautas-pranskunas-
Copy link
Contributor Author

So at the end what you want me to do? :) ignore message or?

@vincenzopalazzo
Copy link
Collaborator

So at the end what you want me to do? :) ignore message or?

PRs are welcome!

@vincenzopalazzo vincenzopalazzo added help wanted Extra attention is needed dart client Issue relates mainly to the standalone dart client ⌛ reproduction needed Issue is subtle and requires a true accessible reproduction to debug Priority: Waiting to be assigned To be inside the next release process, it need to be marked with some level of priority labels Mar 15, 2023
@vytautas-pranskunas-
Copy link
Contributor Author

I see. However it would be much quicker for author (you) to fix this one because the time i need to get into this package for such small issue will be 10x times comparing to author. If there is a bigger issue then i do not mind.

@vincenzopalazzo
Copy link
Collaborator

➜  graphql-flutter git:(main) git grep "Initialising connection"
packages/graphql/lib/src/links/websocket_link/websocket_client.dart:      print('Initialising connection');

Just that, 10 seconds for everyone not just for me, if you make a PR please follow https://zino-hofmann.github.io/graphql-flutter/docs/dev/MAINTAINERS.html

@vytautas-pranskunas-
Copy link
Contributor Author

Heh, this is 10s you are right, but what I was talking about it is not about the message it slef but about possibility that thi smessage is just intermediate state! like:
Disconnected
Initializing
Connected

So in order to understand this i need to get into the code and this is time consuming thing ;)

@vytautas-pranskunas-
Copy link
Contributor Author

however, few lines bellow there is a line with:

_connectionStateController.add(SocketConnectionState.connected);

mabe we need to add another message there
print('Connected to websocket');

@vytautas-pranskunas-
Copy link
Contributor Author

PR is added: #1309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart client Issue relates mainly to the standalone dart client help wanted Extra attention is needed ⌛ reproduction needed Issue is subtle and requires a true accessible reproduction to debug Priority: Waiting to be assigned To be inside the next release process, it need to be marked with some level of priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants