Kaspar Schiess avatar Kaspar Schiess committed 9b6b15c

More examples

Comments (0)

Files changed (2)

nanomsg/pubsub.html

-<!DOCTYPE html><html><head><title>nanomsg (Ruby)</title><meta content="width=device-width, initial-scale=1.0" name="viewport" /><link href="stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/bootstrap-theme.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/code.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/nanomsg.css" media="screen" rel="stylesheet" type="text/css" /><script src="javascripts/bootstrap.min.js" type="text/javascript"></script></head><body><div class="container menu"><div class="row"><div class="col-md-2 menu-item"><a href="./">ABOUT</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="pair.html">PAIR</a></div><div class="col-md-2 menu-item"><a href="reqrep.html">REQ/REP</a></div><div class="col-md-2 menu-item active">PUB/SUB</div><div class="col-md-2 menu-item"><a href="surveyrespond.html">SURVEY/RESPOND</a></div><div class="col-md-2 menu-item"><a href="pushpull.html">PUSH/PULL</a></div><div class="col-md-2 menu-item"><a href="bus.html">BUS</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="documentation.html">DOCUMENTATION</a></div><div class="col-md-2 menu-item"><a href="contrib.html">CONTRIB</a></div></div></div><div class="container"><div class="row"><div class="schema"><img src="images/pubsub.png" /></div><div class="caption">Messages travel from the Publisher to the Subscribers.</div></div></div></body></html>
+<!DOCTYPE html><html><head><title>nanomsg (Ruby)</title><meta content="width=device-width, initial-scale=1.0" name="viewport" /><link href="stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/bootstrap-theme.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/code.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/nanomsg.css" media="screen" rel="stylesheet" type="text/css" /><script src="javascripts/bootstrap.min.js" type="text/javascript"></script></head><body><div class="container menu"><div class="row"><div class="col-md-2 menu-item"><a href="./">ABOUT</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="pair.html">PAIR</a></div><div class="col-md-2 menu-item"><a href="reqrep.html">REQ/REP</a></div><div class="col-md-2 menu-item active">PUB/SUB</div><div class="col-md-2 menu-item"><a href="surveyrespond.html">SURVEY/RESPOND</a></div><div class="col-md-2 menu-item"><a href="pushpull.html">PUSH/PULL</a></div><div class="col-md-2 menu-item"><a href="bus.html">BUS</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="documentation.html">DOCUMENTATION</a></div><div class="col-md-2 menu-item"><a href="contrib.html">CONTRIB</a></div></div></div><div class="container"><div class="row"><div class="schema"><img src="images/pubsub.png" /></div><div class="caption">Messages travel from the Publisher to the Subscribers.</div></div><div class="row text"><div class="col-md-6 sample"><pre class="highlight ruby"><span class="c1"># The 'cat' subscriber</span>
+<span class="nb">require</span> <span class="s1">'nanomsg'</span>
+
+<span class="nb">sub</span> <span class="o">=</span> <span class="no">NanoMsg</span><span class="o">::</span><span class="no">SubSocket</span><span class="nf">.new</span>
+<span class="nb">sub</span><span class="nf">.connect</span><span class="p">(</span><span class="s1">'tcp://127.0.0.1:4569'</span><span class="p">)</span>
+
+<span class="nb">sub</span><span class="nf">.subscribe</span> <span class="s1">'cat'</span>
+<span class="nb">p</span> <span class="nb">sub</span><span class="nf">.recv</span> <span class="c1"># =&gt; 'cat 45678'</span>
+</pre><pre class="highlight ruby"><span class="c1"># And here's the 'dog' subscriber</span>
+<span class="nb">require</span> <span class="s1">'nanomsg'</span>
+
+<span class="nb">sub</span> <span class="o">=</span> <span class="no">NanoMsg</span><span class="o">::</span><span class="no">SubSocket</span><span class="nf">.new</span>
+<span class="nb">sub</span><span class="nf">.connect</span><span class="p">(</span><span class="s1">'tcp://127.0.0.1:4569'</span><span class="p">)</span>
+
+<span class="nb">sub</span><span class="nf">.subscribe</span> <span class="s1">'dog'</span>
+<span class="nb">p</span> <span class="nb">sub</span><span class="nf">.recv</span> <span class="c1"># =&gt; 'dog 12345'</span>
+</pre></div><div class="col-md-6 sample"><pre class="highlight ruby"><span class="nb">require</span> <span class="s1">'nanomsg'</span>
+
+<span class="n">pub</span> <span class="o">=</span> <span class="no">NanoMsg</span><span class="o">::</span><span class="no">PubSocket</span><span class="nf">.new</span>
+<span class="n">pub</span><span class="nf">.bind</span><span class="p">(</span><span class="s1">'tcp://127.0.0.1:4569'</span><span class="p">)</span>
+
+<span class="kp">loop</span> <span class="k">do</span>
+  <span class="n">pub</span><span class="nf">.send</span> <span class="s1">'dog 12345'</span>
+  <span class="n">pub</span><span class="nf">.send</span> <span class="s1">'cat 45678'</span>
+
+  <span class="nb">sleep</span> <span class="mi">1</span>
+<span class="k">end</span>
+</pre></div></div></div></body></html>

nanomsg/reqrep.html

 <!DOCTYPE html><html><head><title>nanomsg (Ruby)</title><meta content="width=device-width, initial-scale=1.0" name="viewport" /><link href="stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/bootstrap-theme.min.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/code.css" media="screen" rel="stylesheet" type="text/css" /><link href="stylesheets/nanomsg.css" media="screen" rel="stylesheet" type="text/css" /><script src="javascripts/bootstrap.min.js" type="text/javascript"></script></head><body><div class="container menu"><div class="row"><div class="col-md-2 menu-item"><a href="./">ABOUT</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="pair.html">PAIR</a></div><div class="col-md-2 menu-item active">REQ/REP</div><div class="col-md-2 menu-item"><a href="pubsub.html">PUB/SUB</a></div><div class="col-md-2 menu-item"><a href="surveyrespond.html">SURVEY/RESPOND</a></div><div class="col-md-2 menu-item"><a href="pushpull.html">PUSH/PULL</a></div><div class="col-md-2 menu-item"><a href="bus.html">BUS</a></div></div><div class="row"><div class="col-md-2 menu-item"><a href="documentation.html">DOCUMENTATION</a></div><div class="col-md-2 menu-item"><a href="contrib.html">CONTRIB</a></div></div></div><div class="container"><div class="row"><div class="schema"><img src="images/reqrep.png" /></div><div class="caption">Messages travel from a REQ node (client) 
 to a REP node (service)
-and back again.</div></div><div class="row text"><div class="col-md-6 sample"></div><div class="col-md-6 sample"></div></div></div></body></html>
+and back again.</div></div><div class="row text"><div class="col-md-6 sample"><pre class="highlight ruby"><span class="nb">require</span> <span class="s1">'nanomsg'</span>
+
+<span class="n">req</span> <span class="o">=</span> <span class="no">NanoMsg</span><span class="o">::</span><span class="no">ReqSocket</span><span class="nf">.new</span>
+<span class="n">req</span><span class="nf">.connect</span><span class="p">(</span><span class="s1">'tcp://127.0.0.1:4568'</span><span class="p">)</span>
+
+<span class="n">req</span><span class="nf">.send</span> <span class="s1">'req 1'</span>
+<span class="nb">p</span> <span class="n">req</span><span class="nf">.recv</span> <span class="c1"># =&gt; &quot;rep 1&quot;</span>
+</pre></div><div class="col-md-6 sample"><pre class="highlight ruby"><span class="nb">require</span> <span class="s1">'nanomsg'</span>
+
+<span class="n">rep</span> <span class="o">=</span> <span class="no">NanoMsg</span><span class="o">::</span><span class="no">RepSocket</span><span class="nf">.new</span>
+<span class="n">rep</span><span class="nf">.bind</span><span class="p">(</span><span class="s1">'tcp://127.0.0.1:4568'</span><span class="p">)</span>
+
+<span class="n">rep</span><span class="nf">.recv</span> <span class="c1"># =&gt; 'req 1'</span>
+<span class="n">rep</span><span class="nf">.send</span> <span class="s1">'rep 1'</span>
+</pre></div></div></div></body></html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.