How to make an async call from the ic-agent (Rust) after v0.38

Since ic-agent@v0.38.0 (and in particular, since PR#595), the default behavior for the agent is to use the new /api/v3/... endpoints to send update calls to the IC. I can’t find a way to make an async update call that uses the /api/v2/... from the agent.

The reason I still want to use the v2 API is that the IC WebSocket Gateway doesn’t need to wait for the response from the canister when relying an update envelope received from a client.

cc @Severin

1 Like

There is no function to do this. The ultimate goal will be to deprecate the v2 call endpoint, although that’s far off. Is it infeasible to move your polling to a similar model?

The IC WebSocket gateway works in a fire and forget way when relaying messages to the IC, because the IC WS protocol already handles messages ordering, timeouts, etc.

Since /api/v2/... is going to be deprecated, what approach would you recommend? Spawning a separate task to send the message and avoid blocking the gateway loop?

That’s definitely a possible solution. Incorporating the call result into the message delivery system would probably be the best way forwards, though.