walkr / nanoservice

nanoservice is a small Python library for writing lightweight networked services using nanomsg
MIT License
31 stars 9 forks source link

Multiple subscribers using the examples doesn't seem to work #2

Closed jvsteiner closed 9 years ago

jvsteiner commented 9 years ago

I think this should just work based on the example code, but it doesn't. Any thoughts?

walkr commented 9 years ago

A nanomsg socket can either bind or connect to an endpoint. Only a single socket can bind to a given endpoint, but multiple sockets can connect to it.

If a subscriber binds to an endpoint then it can receive messages it subscribed to, from multiple publishers, if those publishers connected to the same endpoint. On the other hand, if the subscriber connects to an endpoint, then some publisher must bind to it, in which case multiple identical subscribers can be spawned.

A SubService is a subscriber which binds to an endpoint, therefore you cannot have multiple of them.

Here's an illustration I put together to better explain the concept:

pubsub

Cheers

jvsteiner commented 9 years ago

thanks for the explanation, Tony!

Tony Walker mailto:notifications@github.com December 21, 2014 at 7:32 AM

Closed #2 https://github.com/walkr/nanoservice/issues/2.

— Reply to this email directly or view it on GitHub https://github.com/walkr/nanoservice/issues/2#event-210611893.