Adding WebSocket logic.