Updated websocket handler for ctx attributes