You can control the number of retrieved messages by specifying a count parameter in the history request, however, this is limited to a maximum of 100 messages. To retrieve larger sets, use paging utilizing the start and end timetoken parameters. Note that the start timetoken is exclusive and the end timetoken is inclusive. The paging loop can be stopped when there are no more messages (i.e. the last retrieved result contains < 100 messages).
See also:
In case of any questions, contact us at support@pubnub.com.