API Cheat Sheet
A quick reference guide to the Chat SDK API
Code Examples
The demo projects on Github contain some useful code examples.
Configuration
The Chat SDK can be configured using the configuration service.
Config config = ChatSDK.config();
// Example
config.setGoogleMaps("Google Maps API Key");let config: BConfiguration = BChatSDK.config()
// Example
config.googleMapsApiKey = "Google Maps API Key"BConfiguration * config = BChatSDK.config;
// Example
config.googleMapsApiKey = @"Google Maps API Key";Messaging Server API
The Chat SDK uses a series of services to make requests to the messaging server. These services are contained in a class called NetworkAdapter.
BaseNetworkAdapter a = ChatSDK.shared().a();let networkAdapter = BChatSDK.shared()?.networkAdapterid<PNetworkAdapter> networkAdapter = BChatSDK.shared.networkAdapter;Each of these services contains methods to make requests to the server. Here is a full list of the services available:
// Core Methods
CoreHandler core = networkAdapter.core;
AuthenticationHandler auth = networkAdapter.auth;
ThreadHandler thread = networkAdapter.thread;
ImageMessageHandler imageMessage = networkAdapter.imageMessage;
LocationMessageHandler locationMessage = networkAdapter.locationMessage;
ContactHandler contact = networkAdapter.contact;
SearchHandler search = networkAdapter.search;
PublicThreadHandler publicThread = networkAdapter.publicThread;
// Free modules
PushHandler push = networkAdapter.push;
UploadHandler upload = networkAdapter.upload;
// Paid modules
VideoMessageHandler videoMessage = networkAdapter.videoMessage;
AudioMessageHandler audioMessage = networkAdapter.audioMessage;
TypingIndicatorHandler typingIndicator = networkAdapter.typingIndicator;
LastOnlineHandler lastOnline = networkAdapter.lastOnline;
BlockingHandler blocking = networkAdapter.blocking;
NearbyUsersHandler nearbyUsers = networkAdapter.nearbyUsers;
ReadReceiptHandler readReceipts = networkAdapter.readReceipts;
StickerMessageHandler stickerMessage = networkAdapter.stickerMessage;
FileMessageHandler fileMessage = networkAdapter.fileMessage;
EncryptionHandler encryption = networkAdapter.encryption;Examples:
Core Service - Methods connected with the current user
Auth Service - Methods for Authentication
Thread Service - Methods related to Conversation Threads
Messaging Server Notifications
Since messaging happens in realtime, we also need to get notifications from the server. This happens through several mechanisms. For more details see:
Some available for Android and others for iOS:
1. Event Bus (Android)
2. Hooks
Available Hooks
3. Notification Center (iOS Deprecated)
UI Modification Service
Chat SDK provides a way to modify the user interface without forking the library. This can be achieved using the UI server.
The UI service is used to inject views into the app. It also defines which tabs are displayed and much more. For example, you can override Activites, Fragments, and ViewControllers by subclassing them and injecting them using the UI service.
For more details see:
Local Database
The Chat SDK has a powerful local database that is automatically synchronized with the messaging server. It can be accessed using the database service.
The database service can be used to fetch, create, and delete entities. For example:
Each entity then has many methods that can be used. For example:
Note: Creating an entity locally doesn't automatically add it to the server or populate the data from the server. To do that you have to use the network adapter service.
Last updated
Was this helpful?