ios - Retrieve messages with PubNub History API once and use them in multiple views -
ios - Retrieve messages with PubNub History API once and use them in multiple views -
i'm developing app pubnub
ios
sdk
works great, there 1 annoying issue history api
.
i have list message history in multiple view controllers, works well, have wait 2-3 sec messages every time open new view. there mutual practice avoid this?
i'm using requesthistoryforchannel
: block in every view controllers viewdidload
. know it's problem because every time open new view client needs reconnect , retrieve history again, not find improve solution. have download same channel's history in every view, content same, hence think it's absolutely possible fetch messages when launch app , utilize info across whole app , don't wait, have no thought how it.
actually, not issue of pubnub sdk. can suggest create info model manage caching , pull history when required or think should pull out.
as reconnection: pubnub sdk maintain few tcp connections time , doesn't teardown them till application suspension or disconnect request. fact, took 2 seconds mean there important amount of data, slow connection or both cases. can limit amount of messages want receive using limit
parameter or can piece messages using startdate
, enddate
parameters (there lot of designated methods related history api).
ios objective-c pubnub
Comments
Post a Comment