Answer the question
In order to leave comments, you need to log in
Why can't Tornado Websockets see cookies?
Cookies are immediately sent to the client on the main page:
class IndexHandler(RequestHandler):
def get(self):
if not self.get_secure_cookie("user"):
self.set_secure_cookie("user", "1213", domain='127.0.0.1')
self.render("index.html",)
var ws = new WebSocket("ws://localhost:8888/websocket");
// и т.д
class HiHandler(WebSocketHandler):
def open(self):
print("WebSocket opened")
print("received cookies: ", self.request.cookies)
print("received 'myuser': ", self.get_secure_cookie("user"))
WebSocket opened
received cookies:
received 'myuser': None
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question