Overview
The GraphQL API combines both real-time and historical information from the MQTT data-source and TimescaleDB. It is also possible to combine both data-sources in a single query. For example you could query real-time measurements from the MQTT data-source while also querying object class meta-data for each measurement from the database.
Example Query
A GraphQL query as described before could look like this:
subscription {
measurements(source: 1, intervalMs: 1000) {
# this information is streamed from the MQTT broker
trackingId
time
sensorName
velocityMs
data
lat
long
# this information is internally queried from the class table
class {
id
name
}
}
}
The diagram below shows, where and how the data for the previous query is sourced from.
To execute the query, you can use the GraphiQL IDE. For using the syntax: Learn how to fetch data from a GraphQL server.
