Workers Websocket Send Message on External Event
Hello! I'm looking for an elegant solution (if possible) to run a websocket and simultaneously allow external events to be sent to (all) websockets e.g. when a POST request is sent to the worker.
Situation: I want to run a websocket (easy part) and have it be able to send messages when a separate request or event happens outside of that websocket session (hard part). I thought about using a queue and having the websocket listen for messages on the queue, or maybe having a global state or event emitter or literally anything but I can't think of a very good solution to this problem.
Any suggestions?
0 Replies