improve readability of websocket controller