Files
nym/documentation/docs/src/sdk/rust/message-helpers.md
T
2023-11-02 13:19:54 +01:00

1.3 KiB

Message Helpers

Handling incoming messages

As seen in the Chain querier tutorial when listening out for a response to a sent message (e.g. if you have sent a request to a service, and are awaiting the response) you will want to await non-empty messages (more info on this here). This can be done with something like the helper functions here.

Iterating over incoming messages

It is recommended to use nym_client.next().await over nym_client.wait_for_messages().await as the latter will return one message at a time which will probably be easier to deal with. See the parallel send and receive example for an example.

Remember to disconnect your client

You should always manually disconnect your client with client.disconnect().await as seen in the code examples. This is important as your client is writing to a local DB and dealing with SURB storage.