<p>hi there,</p>
<p>I've just pushed a few examples for my pure-Go implementation of ZeroMQ-4 sockets:</p>
<ul>
<li><a href="https://github.com/go-zeromq/zmq4">https://github.com/go-zeromq/zmq4</a></li>
</ul>
<p>Implemented so far (with tests against the C bindings of <a href="https://github.com/pebbe/zmq4">pebbe/zmq4</a>):</p>
<ul>
<li>pub/sub</li>
<li>push/pull</li>
<li>req/rep</li>
</ul>
<p>Implemented (but not tested yet):</p>
<ul>
<li>xpub/xsub</li>
<li>router/dealer</li>
<li>pair</li>
</ul>
<p>Enjoy! (and send PRs :P)</p>
<hr/>**评论:**<br/><br/>Ungoliantsspawn: <pre><p>I've been using pebbe/zmq4 for some time now, I greatly appreciate a pure Go version, Thx!</p>
<p>I will be watching your repo closely, cheers!</p></pre>jasonmoo: <pre><p>I’m not well versed in zmq but saw inproc wasn’t implemented. Is that something that could be implemented with a channel that satisfied the net interfaces your lib expects?</p></pre>sbinet: <pre><p>yes, definitely.
IIRC, that's what <a href="https://github.com/go-mangos/mangos">go-mangos/mangos</a> (a pure Go implementation of <code>nanomsg</code>) is doing.</p>
<p>alternatively, and as a short gap solution, one could use either <code>os.Pipe</code> or <code>net.Pipe</code>.</p>
<p><code>net.Pipe</code> already uses a couple of <code>chan</code>s already:</p>
<ul>
<li><a href="https://golang.org/src/net/pipe.go#L118">https://golang.org/src/net/pipe.go#L118</a></li>
</ul></pre>icholy: <pre><p>Sweet! This let's me say goodbye to cgo for one of my projects XD</p></pre>sbinet: <pre><p>Aha :)</p>
<p>I'll post a few histograms comparing latency between cgo-based transport and pure-Go based transport in my favorite application.
Nothing earth shattering, between the pure-Go transport has a better figure of merit.</p></pre>sbinet: <pre><p>here is the initial preliminary little study:</p>
<ul>
<li><p><a href="https://gist.github.com/sbinet/07b5fa628b5278498eea612a0c4b65c3" rel="nofollow">https://gist.github.com/sbinet/07b5fa628b5278498eea612a0c4b65c3</a></p></li>
<li><p><code>nanomsg</code>: <a href="https://github.com/go-mangos/mangos" rel="nofollow">go-mangos/mangos</a></p></li>
<li><p><code>zeromq</code>: <a href="https://github.com/go-zeromq/zmq4" rel="nofollow">go-zeromq/zmq4</a></p></li>
<li><p><code>czmq</code>: <a href="https://github.com/pebbe/zmq4" rel="nofollow">pebbe/zmq4</a></p></li>
</ul>
<p>and my favorite application:</p>
<ul>
<li><a href="https://github.com/sbinet-alice/fer/tree/master/_example/cmd/fer-ex-web-ctl" rel="nofollow">https://github.com/sbinet-alice/fer/tree/master/_example/cmd/fer-ex-web-ctl</a></li>
</ul></pre>
![](https://static.golangjob.cn/static/img/banner.png)