libchan
libchan copied to clipboard
pub/sub broker implementation
After seen the work done in #61 and #63, I think it's worth linking in here that I created a Graft/jschan pubsub broker: https://github.com/GraftJS/graft-broker. Graft-broker can also be backed by Redis, thanks to https://github.com/mcollina/mqemitter-redis, however you can't send channels through it.
I like it, I think we are on the same page that the best way to solve pub/sub is through an attached service. Thanks for linking. It is probably a good early example service to implement using the bus/job engine.
A question: a pub/sub service can generate loops with channels, like so:
- session A subscribes to topic "hello"
- session B subscribes to topic "hello"
- session A publishes a "write" channel to to topic hello
- session A receives its own channels from the broker
- session B recevies a "read" channel to to topic hello
Summarizing, In jschan when a channel is received from the originating session it returns the originating channel, however, all the other parties receives the "inverted" channel. Is that the right behavior?
While it does not make any sense whatsoever to send back a channel with a normal service invocation, in pub/sub scenarios it might happen. Is this the correct behavior? Should jschan error? How this case is handled in libchan?
@AdrianRossouw