Fixing session creation, tidying up websocket handler a bit.