3 ms·
That still assumes you use session cookies at all. As I said, you can keep authentication entirely within the confines of the websocket connection, deliver only
by derefr 13y ago
That still assumes you use session cookies at all. As I said, you can keep authentication entirely within the confines of the websocket connection, deliver only non-user-specific static assets over HTTP(S), and persist your authentication token client-side in localStorage/sessionStorage, thus avoiding cookies entirely. Which is actually the best practice for libraries like SockJS, since they rely on (and encourage the use of) cross-domain connections that can't see your cookies.
Of course, using localStorage (which doesn't have the equivalent to cookies' HTTPOnly attribute) makes the Javascript-injection attack even more effective--but that's a bit of an airtight hatchway problem[1]. If you already have control of the user's DOM, you can just make it look like they were logged out and phish their credentials out of them.
[1] http://blogs.msdn.com/b/oldnewthing/archive/2007/09/20/5002739.aspx http://blogs.msdn.com/b/oldnewthing/archive/2007/09/20/50027...