Is there a way to get the conversation without calling the fetchHistory command?
Our users is questioning about after refreshing, it takes time to load the cache. I am always invoking the following to get the previous message but if there is a way to cache it and load it, it will really be faster.
Genesys('command', 'MessagingService.fetchHistory');
Generally speaking, you shouldn't retrieve the whole history at page load, but chunks of 25 messages at a time. After registering the plugins, subscribing to MessagingService.restored will retrieve the most recent chunk of messages (up to 25) which you will render in the widget, for this first chunk the fetchHistory is therefore not needed. Then typically, only when the user scrolls up and reaches the top (so the oldest of these first 25 messages) , by executing the fetchHistory the second chunk of 25 messages will be loaded and returned by the subscription "MessagingService.oldMessages" (to be displayed). When the user scrolls again, this repeats until the subscription "MessagingService.historyComplete" tells that the user reached the real start of the conversation so no more calls to fetchHistory should be executed. The gist is: the first chunk of messages is retrieved without fetchHistory, and that takes only 3 seconds or so (like in the native Messenger).