How to Send and Receive Ephemeral Events

This guide covers how to send and receive Ephemeral Events with the Vonage Client SDK. Before you begin, make sure you added the SDK to your app, created a Session (Android, iOS, JS), and joined a Conversation.

Ephemeral Events are short-lived Events that are delivered to all App Members in a Conversation. They do not get stored in the Conversation unlike Custom Events. Therefore when you get a Conversation's Events they will not be returned.

Ephemeral Events are best suited for implementing recurring Custom Events such as typing indicators.

Sending Ephemeral Events

Given a Conversation ID, you can send an Ephemeral Event. It is recommended that you use a JSON for your custom data and include a type parameter, e.g. type: 'ephemeral:typingStart'.

const typingStartEvent = {
    member: memberId,
    type: "typing:start"
};

client.sendEphemeralEvent(conversationId, typingStartEvent)
    .then(timestamp => {
        console.log("Successfully sent ephemeral event at ", timestamp);
    }).catch(error => {
        console.error("Error sending ephemeral event: ", error);
    });

Receiving Ephemeral Events

You can receive all Conversation Events in your application by setting up an Event Listener/Delegate Function. Here you can check the kind of incoming Event.