docker / libchan

Like Go channels over the network
Apache License 2.0
2.47k stars 142 forks source link

pub/sub broker implementation #64

Open mcollina opened 9 years ago

mcollina commented 9 years ago

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.

dmcgowan commented 9 years ago

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.

mcollina commented 9 years ago

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