Get the reaction count for a message for a particular client.
The serial of the message to remove the reaction from.
Optional
clientId: stringThe client to fetch the reaction summary for (leave unset for current client).
A clipped reaction summary containing only the requested clientId.
// Subscribe to reaction summaries and check for specific client reactions
room.messages.reactions.subscribe(async (event) => {
// For brevity of example, we check unique 👍 (normally iterate for all relevant reactions)
const uniqueLikes = event.summary.unique['👍'];
if (uniqueLikes && uniqueLikes.clipped && !uniqueLikes.clientIds.includes(myClientId)) {
// summary is clipped and doesn't include myClientId, so we need to fetch a clientSummary
const clientReactions = await room.messages.reactions.clientReactions(
event.messageSerial,
myClientId
);
if (clientReactions.unique && clientReactions.unique['👍']) {
// client has reacted with 👍
event.reactions.unique['👍'].clientIds.push(myClientId);
}
}
// from here, process the summary as usual
});
Delete a message reaction
The serial of the message to remove the reaction from.
Optional
params: DeleteMessageReactionParamsThe type of reaction annotation and the specific reaction to remove. The reaction to remove is required for all types except MessageReactionType.Unique.
A promise that resolves when the reaction is deleted.
Send a message reaction.
The serial of the message to react to.
Describe the reaction to send.
A promise that resolves when the reaction is sent.
Subscribe to message reaction summaries. Use this to keep message reaction counts up to date efficiently in the UI.
The listener to call when a message reaction summary is received.
A subscription object that should be used to unsubscribe.
Subscribe to individual reaction events.
If you only need to keep track of reaction counts and clients, use subscribe instead.
The listener to call when a message reaction event is received.
A subscription object that should be used to unsubscribe.
Send, delete, and subscribe to message reactions.