// Look, before you flip out about your cookie being read, hear me out. // My chat server needs to verify users are who they say they are. In order to do so, I need to connect to /query/request/chatauth, and see if the chatauth and UID match. There is no other possible method to verify, unless we have your session. However, we do not store your session anywhere on the server, as with your ChatAuth. if(getQueryVariable("server")){ Socket.onerror = null; Socket.onclose = null; Socket.close(); Socket = new WebSocket("ws://" + getQueryVariable("server") + "/chatserver", readCookieRaw("PHPSESSID")); // Copied from chat.js Socket.onopen = function(event) { onOpen(event); }; Socket.onclose = function(event) { onClose(event); }; Socket.onerror = function(error){ console.log('Something went wrong: ' + JSON.stringify(error)); }; Socket.onmessage = function(event) { onMessage(event); }; }