class WebSocketHandler(tornado.websocket.WebSocketHandler):

    def open(self):
        user_id = self.get_secure_cookie('user')
if not user_id:
    return None
User authentication in tornado websocket application