Last updated
Last updated
The Sending.Network iOS SDK provides a messaging framework that enables you to integrate chatroom and notification services within your mobile applications. This quickstart will show you how to set up the SDK and make API calls like user registration, room creation, etc. Let's explore how we would make a simple client that can send and receive messages, create a chat room, get member lists, etc.
You can connect to SDN network by running a local P2P service or connecting to an existing Edge Node.
To build the application that connects to an existing Edge Node, add the following line to the podfile.
If you connect to an existing edge node in the previous step, you can safely skip this step. To create a local P2P service:
If you choose to connect to an existing Edge Node in the previous step, please contact developer@sending.network for a test node URL and assign it tocredentials.homeserver
.
Keeping your access token safe is essential, as it allows complete access to your account.
Instantiate a new client object and use the access token to log in:
Next, we start the client which sets up the connection to the server and performs the first sync, then listen for the response to get the latest state from the server:
If you are only interested in some specific type of event, you can set the value of the parameter types
:
If you want to chat with a user, you can create a private room.
Now you can create a room to chat with a specific interest group.
It's time to invite users to the room you created.
To get messages, we need to reuse the mxSession
instance created before:
To post a message, we create a content message and specify a room.
OS
iOS 14 or above
Software
Xcode 13.0 or above