Move websocket message handler to context