libchan icon indicating copy to clipboard operation
libchan copied to clipboard

pub/sub broker implementation

Open mcollina opened this issue 11 years ago • 2 comments

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.

mcollina avatar Oct 24 '14 17:10 mcollina

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.

dmcgowan avatar Oct 24 '14 18:10 dmcgowan

A question: a pub/sub service can generate loops with channels, like so:

  1. session A subscribes to topic "hello"
  2. session B subscribes to topic "hello"
  3. session A publishes a "write" channel to to topic hello
  4. session A receives its own channels from the broker
  5. 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

mcollina avatar Oct 25 '14 17:10 mcollina