rdkcentral / mock-firebolt

An advanced, controllable mock Firebolt OS implementation, which can also act as a reverse proxy to a real Firebolt OS running on a real device
Apache License 2.0
4 stars 21 forks source link

SYSTEST-9338 - Send events to the WS object that subscribed to it #122

Closed ksentak closed 1 year ago

ksentak commented 1 year ago

Background Mock Firebolt now supports multiple connections per user by utilizing an array/map of WS connections per userId.

This presents a problem for situations in which MF is tasked with triggering an event for a user. If a user is connected to MF with multiple connections, there is currently no way for MF to know which connection to send the requested event to.

In order to properly inject events, we must know which connection began listening to the requested event.

Implementation MF already keeps track of which users are listening to which events. This is in order to support "sendEvent()" and "sendBroadcastEvent()" functionalities in YAML overrides as well as sending events manually using the --event CLI and its associated API. This same functionality can be extended to include which connection is listening to an event.

From there, the event functionality can be enhanced to send events to only the connections that are listening for it.

Changes Made