Chat¶
Sending chat messages is probably the most common operation you will perform using the SDK.
Is also the simplest type of message, and allows you to send and receive plain text messages between two nodes.
Sending a Chat Message¶
To send a chat message:
- Create the message content:
- Send the message to a specific address:
Note: Check out the Discovery section for documentation on how to obtain the node address.
Receiving a Chat Message¶
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:
TDLR; You can find the final example at https://github.com/joinself/self-go-sdk/blob/main/examples/chat/request/main.go
TDLR; You can find the final example at https://github.com/joinself/self-sdk-examples/blob/main/java/chat/src/main/kotlin/com/joinself/Chat.kt
You can find the final example at https://github.com/joinself/self-sdk-examples/blob/main/android/chat-qrcode/src/main/java/com/joinself/example/MainActivity.kt
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.