tornadio
tornadio copied to clipboard
HTTPError: HTTP 401: Unauthorized (Invalid session)
polling.py
, line 66, raises this error if the XHR long-polling session expires.
Can you elaborate on this a bit more? How does this occur and why is the default 30 seconds? This seems to cause strange behavior on the client-side — how can my clients handle this gracefully?
Thanks :)
(Also, I'd like to add, other than this, TornadIO has been working flawlessly. Great job.)
Hi,
There are two possible scenarios:
- It took longer than 15 seconds for client to reconnect after previous request.
- Browser closed connection, which is considered as a erroneous condition by socket.io
- Happens if your server declined connection (closed it, but client decided to reconnect).
Here's "normal" XHR long-polling working sequence:
- Client makes request
- Server accepts request and keeps it for 20 seconds (by default) open
- If there's no data to be sent to the client, server sends empty packet and closes connection
- Client sees that something was received and reconnects with same session id.
So, if you changed long-polling timeout to 30 seconds, there's chance that browser will kill running connection, which will raise exception in socket.io, which will prevent socket.io to reconnect automatically.
Serge.
On 27.04.2011 10:27, statico wrote:
polling.py
, line 66, raises this error if the XHR long-polling session expires.Can you elaborate on this a bit more? How does this occur and why is the default 30 seconds? This seems to cause strange behavior on the client-side — how can my clients handle this gracefully?
Thanks :)
Just in case, I can prevent it from throwing exception - some debugging message might work better. Newer versions of socket.io (6.x branch) now understand that server does not want them with their session id and will attempt to reconnect to get new session id.
What would be the proper way to "hide" that exception? All the stack traces make the terminal output quite unreadable when restarting the server.
Hi,
You can stop request here: https://github.com/MrJoes/tornadio/blob/master/tornadio/polling.py#L64
Right now it will send back proper response (http code 401, but it will be also logged).
Serge.
On Sun, Jul 31, 2011 at 4:30 PM, tcatm [email protected] wrote:
What would be the proper way to "hide" that exception? All the stack traces make the terminal output quite unreadable when restarting the server.
Reply to this email directly or view it on GitHub: https://github.com/MrJoes/tornadio/issues/13#issuecomment-1695048