<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 2, 2014 at 1:04 PM, MinRK <span dir="ltr"><<a href="mailto:benjaminrk@gmail.com" target="_blank">benjaminrk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div class=""><p style="margin:1.2em 0px!important">On Fri, May 2, 2014 at 9:04 AM, Doug Blank <<a href="mailto:doug.blank@gmail.com" target="_blank">doug.blank@gmail.com</a>> wrote:</p>



<p style="margin:1.2em 0px!important"></p><div><p></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>On Thu, May 1, 2014 at 5:35 PM, MinRK <span dir="ltr"><<a href="mailto:benjaminrk@gmail.com" target="_blank">benjaminrk@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">ROUTER sockets use an IDENTITY prefix to determine who the recipient should be. </div>




</blockquote><div><br></div></div><div>Ok, I think I understand, but still not working. Here is some wording that (if correct) could be inserted in an expanded discussion of the wire protocol (which doesn't yet mention socket type):</div>


</div></div></div></blockquote><p></p></div><p style="margin:1.2em 0px!important"></p>
<p style="margin:1.2em 0px!important"></p><div><p></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><a href="http://ipython.org/ipython-doc/dev/development/messaging.html#the-wire-protocol" target="_blank">http://ipython.org/ipython-doc/dev/development/messaging.html#the-wire-protocol</a><br>


</div><div><br></div><div>
"""</div>
<div>If you only want to implement basic functionality (one frontend per kernel, no parallel or cluster support) then using DEALER instead of ROUTER is fine, and a good place to start because you don't need the complexity of the routing protocol. You can simply leave out the routing prefixes before the <IDS|MSG> delimiter in the wire protocol.</div>




<div><br></div><div>If you do want more than the basic functionality (such as allowing two frontends to a kernel) then you must use the ROUTER socket type, and must have the correct routing prefixes.</div><div>"""</div>


</div></div></div></blockquote><p></p></div><p style="margin:1.2em 0px!important"></p>
</div><p style="margin:1.2em 0px!important">I would not add this. I would consider it purely an accident that any kernel with DEALER sockets sometimes appears to work, and no kernel should ever use DEALER sockets on the kernel. </p>
</div></div></blockquote><div>Just to be clear, using DEALER always works without any routing identifiers, with all of the frontends (only one at a time, or course). IPython may not have been design to work this way, may have security issues, and may not work in the future. But with IPython 1, and 2, it works. But now to my question:</div>
<div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:1.2em 0px!important">I think suggesting that DEALER sockets might work in simple cases would only increase the likelihood that new kernels use dealer sockets, when none should.</p>



<p style="margin:1.2em 0px!important">The addition of a kernel_info request at startup, which is about to go into IPython master, will mean that no kernel using DEALER sockets will work in any frontend, because there will be a minimum of two client sockets connected to the kernel’s shell channel.</p>
<div class="">


<p style="margin:1.2em 0px!important"></p><div><p></p><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">

<div><br></div><div>The problem is that I haven't gotten the routing to work, and it seems like it deserves some documentation. For example, watching the IPython kernel, I appear to see the following kinds of routing:</div>



<div><br></div><div>message type: "kernel_info_reply", routing appears to be "SESSION_ID":</div><div><br></div><div><div><br></div></div><div><div>message type: "status", routing appears to be "kernel.KERNEL_ID.status":</div>
</div><div><br></div><div><div><br></div></div><div>message type: "execute_repl", routing is "execute_reply", raw data (end of message) is list of session ids:</div><div><br></div><div><div><br></div></div>
<div>Am I reading this correctly? If so, then many kernel developers may stop at basic communication and use DEALER (which is fine, I guess). For those of us you want to implement the full spec (with the expectation of having parallel engines working), each of these cases will need to be dealt with, right?</div>


</div></div></div></blockquote><p></p></div><p style="margin:1.2em 0px!important"></p>
</div><p style="margin:1.2em 0px!important">I suppose I should add a bit of a zmq primer to the message spec.  The relevant bits:</p>
<p style="margin:1.2em 0px!important">ROUTER sockets use IDENTITIES to pick the peer to send messages to. This is the part of the message preceding the ‘‘ delimiter. A ROUTER <em>must</em> send replies with the same routing prefix as the requests it receives.</p>
</div></div></blockquote><div>That is an important bit of info! The IPython section on the wire protocol is very misleading in this routing section.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;overflow:auto;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline;background-color:rgb(248,248,248);white-space:pre-wrap;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,255)"><span style="background-color:rgb(255,255,255);font-family:arial;font-size:small;line-height:normal;color:rgb(34,34,34)">PUB sockets are different. PUB sockets use only the first message part as a TOPIC, on which sub sockets can filter. In IPython, this is generally ignored, but the message spec describes what IPython does with pub topics. The PUB topic should </span><em style="background-color:rgb(255,255,255);font-family:arial;font-size:small;line-height:normal;color:rgb(34,34,34)">not</em><span style="background-color:rgb(255,255,255);font-family:arial;font-size:small;line-height:normal;color:rgb(34,34,34)"> be the routing prefix used by the ROUTER socket.</span></code></pre>
</div></blockquote><div>What is the "first message part"?</div><div><br></div><div>Rather than a primer on zmq, I'd rather see something very specific with respect to IPython. What does the request look like? What should the PUB response look like? What would a ROUTER response look like?</div>
<div><br></div><div>Is it true that all kernel sends are in response to a request, except for the very first "starting" status message? In that case, it creates a routing identity from scratch?</div><div><br></div>
<div>Thanks so much... I feel I am getting close!</div><div><br></div><div>-Doug </div></div><br></div></div>