Having written my thoughts on the subject in What's everyone building?, it seemed a shame not to just write the code!
Here’s my first attempt at a pub-sub implementation for Anvil apps:
Having written my thoughts on the subject in What's everyone building?, it seemed a shame not to just write the code!
Here’s my first attempt at a pub-sub implementation for Anvil apps:
That library is now updated to add an ‘unsubscribe’ method.
(And, yes, I did get bitten by the warning in the README about why you might need to unsubscribe)!
Did you end up implementing something that would allow this functionality you described in your original post?
I’m also thinking of making Publisher a portable class so a copy could reside on the server, probably in the session. The client side could then poll its server side sibling for messages at regular intervals and publish them to subscribers.
Possibly just the messages would be portable and the publishers separate. Not sure yet.
Still thinking this one through…
I’m pretty excited: I think this, together with your ORM, is going to make an app I have been building much simpler and more maintainable.
No, I haven’t had time to get that done, I’m afraid.
v0.1.3 released with new close_channel
method on the publisher.