Skip to content

jolienai/hasura-subscriptions-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL Subscription using Hasura C# example

  • .Net core 5
  • GraphQL.Client 3.2.4
  • GraphQL.Client.Serializer.Newtonsoft 3.2.4

Documentation

https://hasura.io/docs/latest/graphql/core/databases/postgres/subscriptions/index.html

subscription

See below the subscription as an example based on 2 tables vehicle and vehicle_location to get the lasted vehicle location

subscription getLocation($vehicleId: Int!) {
  vehicle_location(where: {vehicle_id: {_eq: $vehicleId}}, order_by: {timestamp: desc}, limit: 1) {
    id
    location
    timestamp
    vehicle {
      id
      vehicle_number
    }
  }
}

How do run

  1. Run Hasura using the docker compose file
docker-compose up -d
  1. Create the tables vehicle and vehicle_location

  2. Run the C# console app

  3. Add some data using the Hasura UI, should see the app is displaying the latest location.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published