Handling Events
Running an app containing the SDK allows you to send messages or perform other actions. At the same time, when the app is online it will fetch events send to it (e.g. receiving a message). The SDK parses these events and then allows you to setup a "callback", triggering actions based on specific events being received.
For example, you might want to "react" to "text message received", and make a Rest call when the message contains a specific string, or you might want to track when a new users joins a conversation where the app is present.
Practically, when you implement some of the events handler of WireEventsHandler, your App will be notified when an event is received from the WebSocket connection.
Below is a table of existing events that can be received and what are their purpose:
| Name | Description |
|---|---|
onTextMessageReceived | A Text message was received. |
onAppAddedToConversation | The App has been added to a conversation. |
onConversationDeleted | A conversation that the App was part of, was deleted. |
onAssetMessageReceived | An Asset (file) was received. |
onButtonClicked | A button action (button press/click) was received. From a composite message. |
onPingReceived | Attention-getting message was received. |
onLocationMessageReceived | A message containing location details (longitude, latitude). |
onMessageDeleted | When a message is deleted. |
onMessageDelivered | When your message was DELIVERED or another user has read your message. |
onTextMessageEdited | An existing message was edited. |
onMessageReactionReceived | When a user has reacted to a message. |
onInCallReactionReceived | Received an emoji while in a call. |
onInCallHandRaiseReceived | Received the Hand Raise emoji while in a call. |
onUserJoinedConversation | When one or more users joined a conversation the App is part of. |
onUserLeftConversation | When one or more members leave or are removed from a conversation, including cases where the app itself is removed from the conversation. |