class_docstr: A utility class to register callbacks when a zmq socket sends and receives
  
  For use with zmq.eventloop.ioloop
  
  There are three main methods
  
  Methods:
  
  * **on_recv(callback, copy=True):**
      register a callback to be run every time the socket has something to receive
  * **on_send(callback):**
      register a callback to be run every time you call send
  * **send(self, msg, flags=0, copy=False, callback=None):**
      perform a send that will trigger the callback
      if callback is passed, on_send is also called.
      
      There are also send_multipart(), send_json(), send_pyobj()
  
  Three other methods for deactivating the callbacks:
  
  * **stop_on_recv():**
      turn off the recv callback
  * **stop_on_send():**
      turn off the send callback
  
  which simply call ``on_<evt>(None)``.
  
  The entire socket interface, excluding direct recv methods, is also
  provided, primarily through direct-linking the methods.
  e.g.
  
  >>> stream.bind is stream.socket.bind
  True
class_docstr_tok: ["A","utility","class","to","register","callbacks","when","a","zmq","socket","sends","and","receives","For","use","with","zmq.eventloop.ioloop","There","are","three","main","methods","Methods",":","*","*","*","on_recv","(","callback",",","copy=True",")",":","*","*","register","a","callback","to","be","run","every","time","the","socket","has","something","to","receive","*","*","*","on_send","(","callback",")",":","*","*","register","a","callback","to","be","run","every","time","you","call","send","*","*","*","send","(","self",",","msg",",","flags=0",",","copy=False",",","callback=None",")",":","*","*","perform","a","send","that","will","trigger","the","callback","if","callback","is","passed",",","on_send","is","also","called",".","There","are","also","send_multipart","(",")",",","send_json","(",")",",","send_pyobj","(",")","Three","other","methods","for","deactivating","the","callbacks",":","*","*","*","stop_on_recv","(",")",":","*","*","turn","off","the","recv","callback","*","*","*","stop_on_send","(",")",":","*","*","turn","off","the","send","callback","which","simply","call","``","on_","<","evt",">","(","None",")","``",".","The","entire","socket","interface",",","excluding","direct","recv","methods",",","is","also","provided",",","primarily","through","direct-linking","the","methods",".","e.g",".",">",">",">","stream.bind","is","stream.socket.bind","True"]
docstr: Register a callback for when a message is ready to recv.
  
  There can be only one callback registered at a time, so each
  call to `on_recv` replaces previously registered callbacks.
  
  on_recv(None) disables recv event polling.
  
  Use on_recv_stream(callback) instead, to register a callback that will receive
  both this ZMQStream and the message, instead of just the message.
  
  Parameters
  ----------
  
  callback : callable
      callback must take exactly one argument, which will be a
      list, as returned by socket.recv_multipart()
      if callback is None, recv callbacks are disabled.
  copy : bool
      copy is passed directly to recv, so if copy is False,
      callback will receive Message objects. If copy is True,
      then callback will receive bytes/str objects.
  
  Returns : None
docstr_tok: ["Register","a","callback","for","when","a","message","is","ready","to","recv",".","There","can","be","only","one","callback","registered","at","a","time",",","so","each","call","to","`","on_recv","`","replaces","previously","registered","callbacks",".","on_recv","(","None",")","disables","recv","event","polling",".","Use","on_recv_stream","(","callback",")","instead",",","to","register","a","callback","that","will","receive","both","this","ZMQStream","and","the","message",",","instead","of","just","the","message",".","Parameters","--","--","--","--","--","callback",":","callable","callback","must","take","exactly","one","argument",",","which","will","be","a","list",",","as","returned","by","socket.recv_multipart","(",")","if","callback","is","None",",","recv","callbacks","are","disabled",".","copy",":","bool","copy","is","passed","directly","to","recv",",","so","if","copy","is","False",",","callback","will","receive","Message","objects",".","If","copy","is","True",",","then","callback","will","receive","bytes\/str","objects",".","Returns",":","None"]
code: def on_recv(self, callback, copy=True):
      """Register a callback for when a message is ready to recv.
  
      There can be only one callback registered at a time, so each
      call to `on_recv` replaces previously registered callbacks.
  
      on_recv(None) disables recv event polling.
  
      Use on_recv_stream(callback) instead, to register a callback that will receive
      both this ZMQStream and the message, instead of just the message.
  
      Parameters
      ----------
  
      callback : callable
          callback must take exactly one argument, which will be a
          list, as returned by socket.recv_multipart()
          if callback is None, recv callbacks are disabled.
      copy : bool
          copy is passed directly to recv, so if copy is False,
          callback will receive Message objects. If copy is True,
          then callback will receive bytes/str objects.
  
      Returns : None
      """
  
      self._check_closed()
      assert callback is None or callable(callback)
      self._recv_callback = stack_context_wrap(callback)
      self._recv_copy = copy
      if callback is None:
          self._drop_io_state(zmq.POLLIN)
      else:
          self._add_io_state(zmq.POLLIN)
  
imports: from __future__ import with_statement
  import sys
  import warnings
  import zmq
  from zmq.utils import jsonapi
  from .ioloop import IOLoop, gen_log
  from zmq.utils.strtypes import basestring
label_desc: Use image node_id 6 for calling the ZMQStream obj's underlying member method code with example usage: obj.on_recv(callback, copy) without return types