cheatcode / joystick

A full-stack JavaScript framework for building stable, easy-to-maintain apps and websites.
https://cheatcode.co/joystick
Other
202 stars 10 forks source link

Add support for subscribers to websockets #372

Open rglover opened 6 months ago

rglover commented 6 months ago

This should be built in. If I want to subscribe to a shared message channel across instances, I should be able to call a function from my websocket definition's onOpen/on_open handler. Behind the scenes, Joystick should handle the wiring to a database you specify in your config where new messages land. In the app, we'd want to have some sort of polling or emitter that listens for database changes and then calls the defined subscriber callback.

The point of this is to avoid the messiness of existing DB pub/sub implementations. They work, but getting stuff in sync/avoiding duplicates can be a headache. We should fix that in Joystick so it's ready-to-go.