updated websocket api to behave like an rpc call