You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey people,
How do I communicate with 2 observers?
I have 2 observers that are listing to a WebSocket stream that emits different types of events: new_order event and leverage_change event.
Both events execute an async function.
If I am receiving a leverage_change I must wait until the execution of the async function is finished before I could run the new_order event. So I need to find a way to notify the new order observer when he can start/stop working.
Does anyone have any design suggestions on how to achieve such a goal?
I drafted a simple code snippet to show the problem:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey people,
How do I communicate with 2 observers?
I have 2 observers that are listing to a WebSocket stream that emits different types of events:
new_order
event andleverage_change
event.Both events execute an async function.
If I am receiving a
leverage_change
I must wait until the execution of the async function is finished before I could run thenew_order
event. So I need to find a way to notify the new order observer when he can start/stop working.Does anyone have any design suggestions on how to achieve such a goal?
I drafted a simple code snippet to show the problem:
And this is the full code if anyone would like to run it:
Beta Was this translation helpful? Give feedback.
All reactions