Chat APIs and In-app Messaging SDKs for Developers, by Developers

Applozic powers multi-platform Chat APIs and in-app Messaging SDKs for Android, iOS and the Web that will enable you to build advanced in-app chat solutions your users will love.

Integrate chat in your application with completely customizable UI kits, powerful messaging APIs and SDKs, developed with exceptional security measures in mind.

Documentation    API Explorer

Real Time Updates

How to establish socket connection to get real time updates

Pre-built customizable chat UI

If you're using our pre-built UI you may skip this section.

Build your UI from scratch

Initialize socket connection

In the login script, we're calling ALSocket.init method to initialize the socket connection.

window.Applozic.ALSocket.init(APP_ID, data, events);
/*
APP_ID : This is your applozic App ID. You can find it using https://console.applozic.com/settings/install
data : object in which you're passing token, device key and websocketurl
                var data = {};
            data.token : token you get in response of login call success
            data.deviceKey = deviceKey you get in response of login call success
            data.websocketUrl = websocketUrl you get in response of login call success
events : Applozic events which you declare before making a login call 
                 (refer installation section for description) 
*/

Typing indicator

Subscribe for typing channel

You need to subscribe to typing channel in order to get real time update about typing status of other user when you're chatting with them personally or on a group.

window.Applozic.ALSocket.subscibeToTypingChannel(subscribeId);

// subscribeId: userId of logged in user.

Send typing status

Once you have subscribed to typing channel then you need to send typing status on keypress which will show typing status on other end.

window.Applozic.ALSocket.sendTypingStatus(status, previousTypingState, userId, otherUserId);

/*
status: 1 (when user is typing) or 0 (when user has stopped writing)
previousTypingState: 1 or 0 (previous typing state)
userId: userId of user
otherUserId: userId of other user (or groupId)
*/

Disconnect and remove typing indicator

This will remove typing status from you chat once you have unsubscribed to typing channel

window.Applozic.ALSocket.unsubscibeToTypingChannel();

Stop notification on desktop site

window.Applozic.ALSocket.unsubscibeToNotification();

Send online/offline status of user

window.Applozic.ALSocket.sendStatus(status);
// status = 0 OFFLINE 
// status = 1 ONLINE

Reconnect socket

By default we're providing reconnect feature in our chat SDK but in case you want to reconnect socket for some use case then you can call below mentioned method.

window.Applozic.ALSocket.reconnect();

Updated about a year ago


What's Next

Conversation

Real Time Updates


How to establish socket connection to get real time updates

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.