class_docstr: A 0MQ Device to be run in the background.
  
  You do not pass Socket instances to this, but rather Socket types::
  
      Device(device_type, in_socket_type, out_socket_type)
  
  For instance::
  
      dev = Device(zmq.QUEUE, zmq.DEALER, zmq.ROUTER)
  
  Similar to zmq.device, but socket types instead of sockets themselves are
  passed, and the sockets are created in the work thread, to avoid issues
  with thread safety. As a result, additional bind_{in|out} and
  connect_{in|out} methods and setsockopt_{in|out} allow users to specify
  connections for the sockets.
  
  Parameters
  ----------
  device_type : int
      The 0MQ Device type
  {in|out}_type : int
      zmq socket types, to be passed later to context.socket(). e.g.
      zmq.PUB, zmq.SUB, zmq.REQ. If out_type is < 0, then in_socket is used
      for both in_socket and out_socket.
      
  Methods
  -------
  bind_{in_out}(iface)
      passthrough for ``{in|out}_socket.bind(iface)``, to be called in the thread
  connect_{in_out}(iface)
      passthrough for ``{in|out}_socket.connect(iface)``, to be called in the
      thread
  setsockopt_{in_out}(opt,value)
      passthrough for ``{in|out}_socket.setsockopt(opt, value)``, to be called in
      the thread
  
  Attributes
  ----------
  daemon : int
      sets whether the thread should be run as a daemon
      Default is true, because if it is false, the thread will not
      exit unless it is killed
  context_factory : callable (class attribute)
      Function for creating the Context. This will be Context.instance
      in ThreadDevices, and Context in ProcessDevices.  The only reason
      it is not instance() in ProcessDevices is that there may be a stale
      Context instance already initialized, and the forked environment
      should *never* try to use it.
class_docstr_tok: ["A","0MQ","Device","to","be","run","in","the","background",".","You","do","not","pass","Socket","instances","to","this",",","but","rather","Socket","types",":",":","Device","(","device_type",",","in_socket_type",",","out_socket_type",")","For","instance",":",":","dev","=","Device","(","zmq.QUEUE",",","zmq.DEALER",",","zmq.ROUTER",")","Similar","to","zmq.device",",","but","socket","types","instead","of","sockets","themselves","are","passed",",","and","the","sockets","are","created","in","the","work","thread",",","to","avoid","issues","with","thread","safety",".","As","a","result",",","additional","bind_","{","in|out","}","and","connect_","{","in|out","}","methods","and","setsockopt_","{","in|out","}","allow","users","to","specify","connections","for","the","sockets",".","Parameters","--","--","--","--","--","device_type",":","int","The","0MQ","Device","type","{","in|out","}","_type",":","int","zmq","socket","types",",","to","be","passed","later","to","context.socket","(",")",".","e.g",".","zmq.PUB",",","zmq.SUB",",","zmq.REQ",".","If","out_type","is","<","0",",","then","in_socket","is","used","for","both","in_socket","and","out_socket",".","Methods","--","--","--","-","bind_","{","in_out","}","(","iface",")","passthrough","for","``","{","in|out","}","_socket.bind","(","iface",")","``",",","to","be","called","in","the","thread","connect_","{","in_out","}","(","iface",")","passthrough","for","``","{","in|out","}","_socket.connect","(","iface",")","``",",","to","be","called","in","the","thread","setsockopt_","{","in_out","}","(","opt",",","value",")","passthrough","for","``","{","in|out","}","_socket.setsockopt","(","opt",",","value",")","``",",","to","be","called","in","the","thread","Attributes","--","--","--","--","--","daemon",":","int","sets","whether","the","thread","should","be","run","as","a","daemon","Default","is","true",",","because","if","it","is","false",",","the","thread","will","not","exit","unless","it","is","killed","context_factory",":","callable","(","class","attribute",")","Function","for","creating","the","Context",".","This","will","be","Context.instance","in","ThreadDevices",",","and","Context","in","ProcessDevices",".","The","only","reason","it","is","not","instance","(",")","in","ProcessDevices","is","that","there","may","be","a","stale","Context","instance","already","initialized",",","and","the","forked","environment","should","*","never","*","try","to","use","it","."]
docstr: Start the device. Override me in subclass for other launchers.
docstr_tok: ["Start","the","device",".","Override","me","in","subclass","for","other","launchers","."]
code: def start(self):
      """Start the device. Override me in subclass for other launchers."""
      return self.run()
  
imports: import time
  from threading import Thread
  from multiprocessing import Process
  from zmq import device, QUEUE, REQ, Context, ETERM, ZMQBindError, ZMQError
label_desc: Use image node_id 14 for calling the Device obj's underlying member method code with example usage: obj.start() and returns: self