Search code examples
cookiestornado

get_secure_cookie("XX") inside tornado.websocket.WebSocketHandler


I have a tornado app with both tornado.web.RequestHandler and tornado.websocket.WebSocketHandler. I set a secure cookie within the request hander. Within the following class I get the cookie (simplified for illustrations purposes):

class SessionHandler(tornado.websocket.WebSocketHandler):
   def open(self):
      print(self.get_secure_cookie("XX"))

This works to get the cookie. I'm happy about this but I don't understand why this works the get_secure_cookie() method is RequestHandler Class. Can someone please tell me the relationship here?

Thanks


Solution

  • It seems that the WebSocketHandler inherits from tornado.web.RequestHandler

    class WebSocketHandler(tornado.web.RequestHandler):
    

    I didn't think that would be the case.