fixes how the delegate is instantiated and the reaction block of the WebSocket handler