Skip to content

Merging 2 websockets into a single one #328

@spyflox

Description

@spyflox

I currently have 2 services:

  • 1 to manage my inputs (InputsStateService)
  • 1 to manage my outputs (OutputsStateService)

I want to create a dashboard on the interface that gives me real-time status updates of my inputs and outputs.
Currently, I am using 2 websockets.

Since my outputs change almost simultaneously with my inputs, I would like to have a single websocket that "merges" the 2 JSON outputs from InputsStateService and OutputsStateService.
Ideally, I would like to remove the websockets from InputsStateService and OutputsStateService and have a third service called DeviceStateService that handles this websocket.
I need to keep StatefulService to handle everything else : MQTT management, read and update state etc.

My knowledge of C is limited.
How can I create a single instance of InputsState and OutputsState and use them in InputsStateService and DeviceState (or in OutputsStateService and DeviceState?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions