Authentication
You can start building a live streaming experience with ready-made user interfaces by installing Sendbird UIKit. The UIKit is an add-on feature to Sendbird Live SDK and installing the UIKit will also install Sendbird Live SDK. Users authenticated through the UIKit can access Sendbird Live SDK without additional authentication.
Before using any UI components from the Sendbird UIKit for iOS, your application must authenticate a user and be connected with the Sendbird server. Then, the instance communicates and interacts with the server using an authenticated user account and the user can use the UIKit's features.
Connect to the Sendbird server
The SendbirdLiveUI.connect()
method connects a user to the Sendbird server using the preset information of the SBUGlobals.currentUser
instance. If the user ID used during the connection attempt doesn't exist on the Sendbird server, a new user account is created with the specified user ID. The SendbirdLiveUI.connect()
method also automatically updates the user profile on the Sendbird server.
User information must be set as currentUser
in SBUGlobals
prior to launching the UIKit. This information will be used for various tasks within the UIKit, and if you don't set currentUser
in advance, there will be restrictions while using the UIKit. The userID
field shown below must be specified. Other fields such as nickname
and profileUrl
are optional and they'll be filled with default values if not specified.
When using any view controllers provided in the UIKit, the connection with the server is automatically made with currentUser
which should be already set in SBUGlobals
.
Connecting the UIKit with the Sendbird server will also connect the embedded Chat UIKit and the Chat SDK to the Sendbird server as well.
Refer to the code below to see how to manually connect a user to the Sendbird server.
Disconnect from the Sendbird server
When the user no longer needs to use features from Sendbird Live SDK, it is recommended to disconnect the user from the server.