poelstra / mhub

Simple, flexible message hub using websockets
MIT License
9 stars 7 forks source link

Stateful messages #6

Closed poelstra closed 8 years ago

poelstra commented 9 years ago

E.g. scores display needs to obtain latest scores when it connects, and possibly whether scores are currently visible. Twitter bar needs a list of the last X tweets.

It may depend on the type of messages/endpoint how this should work.

E.g. for tweets, it may be good to be able to 'remember' the last X bus messages, such that e.g. twitter:add ... and twitter:remove ... messages are simply 'replayed' as soon as a new client connects.

E.g. for scores, it may be better to remember the last message for each command, such that e.g. scores:set <list of scores> and scores:show <true|false>, and replay the last message for each of these keys.

poelstra commented 8 years ago

This is implemented in 9c0e5ad309b5ccc8c3ff29edb2ce1e6eb0e4042f, with persistence to disk in d96781f17c2dfae90f7f1c8fbcfe8993763f6942. Note that TopicQueue was later renamed to TopicState in 28cb426a27c0a250391197d46004fbd9dcff7942.

The latter is available in 0.4.0.