Task(priority:.background,operation:{tryawaitself.account.send(message:message,onAcknowledgement:{msgId,errorinprint("sent: \(msgId) with error: \(error)")})})
Note: Check out the Discovery section for documentation on how to obtain the node address.
Receiving chat messages is just as easy, as we saw on the messaging section you can use the OnMessage hook of your configuration process to receive and process chat messages.
Once you receive the message, you can decode and process the chat message as follows:
This code snippet shows how to extract and log various details from the received chat message, such as the sender's address, message content, and any attachments.