Skip to content

Real time layer #2262

@steff-o

Description

@steff-o

Description
I propose introducing a new layer type that handles real time data that updates frequently

Proposed Solution

  • A new layer and source type is implemented
  • The source subscribes to an event source
  • The event source is implemented outside the scope of origo, thus making the implementation of the layer source an api specification.
  • Events are sent using Server Side Events (SSE) whenever something changes
  • The event can also be the entire new current state
  • On connection a complete initial state may be sent

The rationale behind the design decisions is:

  • SSE is extremely lightweight in the client
  • SSE can utilize same authentication mechanisms as ordinary GET requests (cookies, auth headers etc)
  • Putting the communication with the data source server side hides api keys
  • The data source can be just about anything. In this way the client only has to support one simple event while the server side can implement just about any complex scenario (MQTT, Database, REST Api, Rabbit MQ etc)

Alternatives Considered
Create an integration on the server that populates a database table periodically and just trigger a refresh on the source periodically as proposed in #1631. But that could potentially be resource consuming.

Additional context
This solves the same problem as #1631, but in a less brutal way. Also somewhat related to #1433 which was resolved by implementing a javascript timer (external to origo) refreshing the source.

Metadata

Metadata

Assignees

Labels

PR acceptedAnyone can write a PR for this issue

Projects

Status

Örnsköldsvik

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions