Streaming Backend - Plugin - detect if query timerange is based on now

HI all,
I’m implementing a streaming go backend-plugin based on the mqtt example.
For now its pretty straight forward. But since I want to implement historical and live data I’m looking for a way to distinguish between historical timeframes and “now” based timeframes.

So if the User selects a range like “last 5 Minutes” I want to register a streaming channel. When he selects a range in the past I don’t want.

For now it seams that the only possibility is to look if the “q.TimeRange.To” value is near to a “now” timestamp. Is there a flag where I can detect if the selected range is now based? Or what is the best practice approach here?

Thanxs! MrLight

In addition to the parsed time-range, you also get the original raw values, but they are encoded in the json data.

inspect the actual bytes in the query and you will see a raw section that says “now-5m”:

1 Like