Fix up websocket code handling for easy sessions, etc

Also add cookie utility javascript