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

Do graphql auto reconnects, if websocket connection gets closed? #32

Closed
BartolomeoItaliano opened this issue Nov 6, 2020 · 1 comment

Comments

@BartolomeoItaliano
Copy link

BartolomeoItaliano commented Nov 6, 2020

Hi!
I am writing an app which needs to be up to date with eos blockchain and I am wondering, if I need to handle websockets closing on my end.

In other words:
If websockets close for graphql query do they automatically reconnects if I use your library or I need to manually establish connection again?

Example query:

        const stream = await dfuseClient.graphql(`subscription {
                searchTransactionsForward(query: "receiver:eosio.token action:transfer", irreversibleOnly: false) {
                  cursor
                  trace {
                    matchingActions {
                      json
                    }
                  }
                }
              }`, (message) => {
            if (message.type === "data") {
                console.log(message.data);
            } else {
                console.log(message);
            }
        });

@maoueh
Copy link
Contributor

maoueh commented Nov 6, 2020

Yes, it handles reconnection automatically as well as tracking the stream cursor, check https://github.com/dfuse-io/client-js#features for more features of the library.

Check never miss a beat GraphQL example for a more thorough example: https://github.com/dfuse-io/client-js/blob/master/examples/advanced/graphql-never-miss-a-beat.ts.

This is a bug tracker, questions and support request are best asked in our Telegram channel: https://t.me/dfuseAPI

@maoueh maoueh closed this as completed Nov 6, 2020
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

No branches or pull requests

2 participants