preaction / Yancy

The Best Web Framework Deserves the Best Content Management System
http://preaction.me/yancy/
Other
54 stars 21 forks source link

Add WebSocket feeds to Yancy::Controller::Yancy (Notify plugin) #56

Closed preaction closed 2 years ago

preaction commented 5 years ago

There should be a way to subscribe to data updates using the Yancy::Controller::Yancy. Add the following actions to the controller:

Every update message is a JSON object. The object's keys are item IDs, and the values are either null (if the item has been deleted) or the item changes (which may be the entire item).

The set, create, and delete actions should send a message to any connected WebSockets. Create a new plugin, Yancy::Plugin::Notify available from the helper yancy.notify. This plugin should have three methods:

In the future, Yancy::Plugin::Notify can support message broker backends like Mercury, Redis, Mojo::Pg, etc... to coordinate messages between forked / distributed daemons.

preaction commented 2 years ago

The feed endpoint in Yancy::Controller::Yancy has existed for a while, and serves this need. It is polling-based, which is suboptimal, but optimizations can come later if needed.