Notification mechanism between plugins

I'd like signalk-logbook to be able to notify other plugins when there is a new log entry available. Possible consumers include postgsail (https://github.com/meri-imperiumi/signalk-logbook/issues/51) and a new plugin to print the log entries for "lights out" backup purposes with an Esc/POS receipt printer (https://github.com/meri-imperiumi/signalk-logbook/issues/42). Is there some eventing mechanism that we could utilise, or is announcing this via a Signal K path the way to go?
6 Replies
Teppo Kurki
Teppo Kurki9mo ago
almost forgot to comment here....what do you and @AdrianP think about if we'd solve this by making logbook entries resources and creating notification deltas that would be created|updated|deleted and reference to the resource?
Lille Ø
Lille ØOP9mo ago
That could work. How does that take the time-specific aspect of a log entry into consideration?
AdrianP
AdrianP9mo ago
I think the concept of a logbook entry as a resource is sound. Leveraging the exisiting mechanism will cater for the basics, including notifications being raised on create, update, delete. We may need to look at the current filtering / retrieval mechanism to ensure we address any potential gaps. I am more than happy to collaborate on this.
Teppo Kurki
Teppo Kurki9mo ago
can you elaborate on time-spefic aspect - resources api should support listing / access by time?
Lille Ø
Lille ØOP9mo ago
Yes, I think for logbook the default view of "entries from last N days/hours" is more relevant than entries for a given place. Though the latter could be interesting too So in practical sense, logbook is now a pretty normal REST API. What would be needed to turn it into resources? I might have some time in April, though that is heavily weather dependent. We're starting our summer cruise in two weeks, and we still need to finish the cockpit rebuild, drop mast, haul out, do antifouling etc before then so next weeks are bound to be hectic
Teppo Kurki
Teppo Kurki8mo ago
Implement the time based features to the current resources api & implementation for logbook entries is where i would start
Want results from more Discord servers?
Add your server