go-zeromq / zmq4

[WIP] Pure-Go implementation of ZeroMQ-4
BSD 3-Clause "New" or "Revised" License
341 stars 56 forks source link

Clarify docs a bit about how Listen() and Dial() translate to bind() and connect() #135

Closed bartekpacia closed 1 year ago

bartekpacia commented 1 year ago

I've lost some time when trying to build a very simple pub-sub (without looking at the examples).

I called Socket.Listen() in my sub, and Socket.Dial() on my pub. It had to be reversed to work. I thought docs could clarify this.

Also, I think it a bit confusing that my publisher calls Listen(), as if it was listening for messages. Why was this named like this?

codecov[bot] commented 1 year ago

Codecov Report

Base: 67.71% // Head: 67.54% // Decreases project coverage by -0.16% :warning:

Coverage data is based on head (63f5ffd) compared to base (217f26c). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #135 +/- ## ========================================== - Coverage 67.71% 67.54% -0.17% ========================================== Files 29 29 Lines 1821 1821 ========================================== - Hits 1233 1230 -3 - Misses 487 489 +2 - Partials 101 102 +1 ``` | [Impacted Files](https://codecov.io/gh/go-zeromq/zmq4/pull/135?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-zeromq) | Coverage Δ | | |---|---|---| | [rep.go](https://codecov.io/gh/go-zeromq/zmq4/pull/135/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-zeromq#diff-cmVwLmdv) | `69.17% <0.00%> (-1.51%)` | :arrow_down: | | [internal/inproc/inproc.go](https://codecov.io/gh/go-zeromq/zmq4/pull/135/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-zeromq#diff-aW50ZXJuYWwvaW5wcm9jL2lucHJvYy5nbw==) | `70.88% <0.00%> (-1.27%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-zeromq). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-zeromq)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

bartekpacia commented 1 year ago

@sbinet Sure, will do.

Also could you answer my question?

I called Socket.Listen() in my sub, and Socket.Dial() on my pub. It had to be reversed to work. I thought docs could clarify this. Also, I think it a bit confusing that my publisher calls Listen(), as if it was listening for messages. Why was this named like this?

sbinet commented 1 year ago

needs https://github.com/go-zeromq/license/pull/14

sbinet commented 1 year ago

I called Socket.Listen() in my sub, and Socket.Dial() on my pub. It had to be reversed to work. I thought docs could clarify this. Also, I think it a bit confusing that my publisher calls Listen(), as if it was listening for messages. Why was this named like this?

the Dial/Listen pair is the usual Go vocabulary. I felt compelled to follow this naming convention for a pure-Go package.

another way of describing the pub/sub network, if you will, could be:

sbinet commented 1 year ago

thanks for the PR :)

bartekpacia commented 1 year ago

another way of describing the pub/sub network, if you will, could be:

  • a publisher listens/waits for new subscribers to subscribe to its feed(s)/topic(s)
  • a subscriber dials/connects to a publisher and subscribes to topics.

I didn't think about it this way. It makes sense now!

the Dial/Listen pair is the usual Go vocabulary. I felt compelled to follow this naming convention for a pure-Go package.

I agree with this choice, thanks for following Go idioms in this awesome module :)