Twilio's Programmable Chat client SDKs use paging to improve performance when accessing potentially large collections of chat objects.
While the signature of the individual methods will vary by SDK platform, each paginator has the following accessors:
- A way to obtain the items
- A boolean property indicating if there are subsequent pages
- A method taking the same callback mechanism as the original call to request the next page
The messages collection behaves a bit differently than channels and members since there is a temporal quality to how the objects are typically presented.
The messages collection objects offer the following ways to access items:
getLastMessagesfetches the specified number of messages, starting with the most recent in the collection
getMessagesBeforefetches messages before (and including) the anchor message index specified
getMessagesAfterfetches messages after (and including) the anchor message index specified
messageWithConsumptionIndexfetches the message with the specified index or, if that message is no longer available, the message directly before it
messageWithIndexfetches the message specified by the index, if available
Next: Roles and Permissions
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。