evennia / evennia

Python MUD/MUX/MUSH/MU* development system

Home Page:http://www.evennia.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Inconsistent session tracking between websocket and AJAX webclient

InspectorCaracal opened this issue · comments

Describe the bug

When connecting to evennia with websockets, each tab establishes its own websocket and counts as a separate session for the server.

However, by default, a browser uses the same website session across all tabs. The AJAX method references this same one session for all requests, so all tabs count as the same session for the server and will override each other, even in multisession modes.

Additional context

I don't think either one of these is necessarily wrong or correct, but the fact that they behave differently is less than ideal. That said, I think it would probably be simpler to make the websocket behave like the AJAX method than vice versa.

I studied this issue for #3335 and here are my thoughts:

The Django session middleware expects each 'session' to be its own context. The AJAX webclient absolutely should open a NEW session with the same login, and save it for the duration of that window. Don't cookie it. Use it only for that window. That way each AJAX window will be 100% independent.

You may be able to apply the same logic to browser windows as well, actually. But whether that's the correct behavior is up for debate.

The planned move to SessionDB will involve a refurbishment of the session system down the line. In the interim though, yeah, probably best to go with the websocket isolation-of-session approach here, however one reproduces that with the ajax client.