The Javascript SDK provides interfaces to listen to various events on the client app. Through these interfaces, TapTalk.io notifies the client app of events that happen on your app.
TapTalk.io provides three types of event listeners to notify events to the client app. You will need to register the listener objects to receive event callbacks from TapTalk.io.
Event Listener
Description
TapListener
Listens to general event changes in the application
TapCoreMessageListener
Listens to events when a new/updated message is received by the application
TapCoreChatRoomListener
Listens to room status events such as typing events and online status
TapListener
General events such as notifications will be notified through TapListener. A TapListener instance is required when initializing TapTalk.
JavaScript
1
taptalk.addTapListener({
2
onTapTalkRefreshTokenExpired:()=>{
3
setIsModalRefreshReconnectShow(true);
4
}
5
})
Copied!
TapListener listens to changes in the following methods:
Method Name
Invoked When
onTapTalkRefreshTokenExpired()
User's refresh token has expired. An authentication with a new auth ticket is required.
TapCoreMessageListener
TapCoreMessageListener listens to message-related events, such as receiving new or updated message. TapCoreMessageListener can be registered through the TapCoreMessageManager class.
JavaScript
1
tapCoreChatRoomManager.addMessageListener({
2
onReceiveNewMessage:(messageModel)=>{
3
// do action here
4
},
5
​
6
onReceiveUpdateMessage:(messageModel)=>{
7
// do action here
8
}
9
})
Copied!
Method Name
Invoked When
onReceiveNewMessage()
A new message is received. Returns the newly received message.
onReceiveUpdatedMessage()
An updated message is received. Returns the updated message.
TapCoreChatRoomListener
Room status events such as typing events and online status are notified through TapCoreChatRoomListener. An instance of TapCoreChatRoomListener can be registered from the TapCoreChatRoomManager class.