getChatHistory(before, limit, beforeId)
Request chat history
caution
join() must be called before calling this method
Requests earlier chat messages. This method does not return the messages; they arrive on the chatHistory event.
JavaScript
meeting.on("chatHistory", (messages) => {
// render the older messages
});
// most recent page
meeting.getChatHistory();
// page backwards from the oldest message you already have
meeting.getChatHistory(oldest.created, 50, oldest._id);
All parameters are optional:
| Parameter | Description |
|---|---|
| before | ISO date string of the oldest message you already have, used to page backwards. |
| limit | Page size. Default 50, maximum 100. |
| beforeId | The _id of that oldest message. Used together with before as a stable cursor so messages sharing the same millisecond are not skipped. |
info
If the room's chat history retention is Off (chatHistoryRetentionHours = 0) the server stores nothing, and history is served from the SDK's in-session buffer, which only holds messages received since this client joined.
Each participant is limited to 10 history requests every 10 seconds.