zeromq / rbzmq

Ruby binding for 0MQ

Home Page:http://www.zeromq.org/bindings:ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some ideas for a nicer API

leahneukirchen opened this issue · comments

  • Make it #send(str, opts=0) and #recv(opts=0) (i.e. make the opts 0 by default)
  • Subscribe to everything unless specified otherwise? The Python API seems to do that.

Agreed on default flags = 0.
Would you like to suggest a patch?

As for subscriptions, subscribing for everything by default doesn't make sense. Subscribers that don't want everything would have to unsubscribe immediately, but even then, there would be no guarantee that some messages wouldn't slip through in the short interval between socket creation and unsubscription.

Thanks for the ideas!

I just pushed a change that makes the flags argument optional. I agree with Martin on the subscription behavior, and am leaving it as-is for now.