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: Send a unicode message with an encoding.
  See zmq.socket.send_unicode for details.
docstr_tok: ["Send","a","unicode","message","with","an","encoding",".","See","zmq.socket.send_unicode","for","details","."]
code: def send_string(
      self, u, flags=0, encoding="utf-8", callback=None, **kwargs
  ):
      """Send a unicode message with an encoding.
      See zmq.socket.send_unicode for details.
      """
      if not isinstance(u, basestring):
          raise TypeError("unicode/str objects only")
      return self.send(
          u.encode(encoding), flags=flags, callback=callback, **kwargs
      )
  
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 12 for calling the ZMQStream obj's underlying member method code with example usage: obj.send_string(u, flags, encoding, callback) and returns: self