Last active
March 4, 2018 07:25
-
-
Save akoenig/e8614ec2372ef9daec531ef61743d88a to your computer and use it in GitHub Desktop.
Medium: M2M in GraphQL context (Invoking binding factory and perform and execute query)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createTelemetryBinding } from "./binding"; | |
| const app = async () => { | |
| const telemetry = await createTelemetryBinding( | |
| "https://kqxrmk1pr7.lp.gql.zone/graphql" | |
| ); | |
| while (true) { | |
| const userTelemetry = await telemetry.query.user({}, {}); | |
| // You could write the data to a different storage system, | |
| // e.g. time-series database, etc. | |
| console.log(userTelemetry); | |
| // Wait for one hour before fetching the user telemetry again | |
| await new Promise(resolve => setTimeout(resolve, 60 * 1000 * 60)); | |
| } | |
| }; | |
| app().catch(err => { | |
| process.exit(1); | |
| console.error(err); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment