You can choose from two methods for retrieving the history of a channel. They return the history(if available) in JSON format with message timestamp.
If you do not wish to receive the timestamp of each message, set returnTimestamp
to false
. By default, it is set to true
.
a. Count:
50 latest messages will be returned from the server with their respective timestamps.
cometClient.getHistory(groupChannel, "count", 50, true);
b. Timestamp:
Messages from the given timestamp till date will be returned without their respective timestamps.
cometClient.getHistory(groupChannel, "timestamp", 1354735353657, false);