title: How to pass arguments to Tornado's WebSocketHandler class?
body: <p>I am trying to pass an instance of <code>my_object</code> as an argument when initializing a <code>WebSocketHandler</code> instance in Tornado, so I can use it during the communication. I've tried to do the following but with no success.</p>
  
  <pre><code>class WSWebHandler(tornado.websocket.WebSocketHandler):
      def __init__(self, my_object):
          super(tornado.websocket.WebSocketHandler, self).__init__()
          self.my_object = my_object
  
      def open(self):
          print('new connection')
  
      def on_message(self, message):
          print('message received: %s' % message)
  
      def on_close(self):
          print('connection closed')
  
      def check_origin(self, origin):
          return True
  
  my_object = new My_Object()
  
  application = tornado.web.Application([(r'/ws', WSWebHandler), my_object])
  http_server = tornado.httpserver.HTTPServer(application)
  http_server.listen(8080)
  myIP = socket.gethostbyname(socket.gethostname())
  print ('*** Websocket Server Started at %s***' % myIP)
  tornado.ioloop.IOLoop.instance().start()
  </code></pre>
  
  <p>Any guess of where I am mistaken?</p>
  
  <p>Thanks in advance</p>