private void PubnubCatchUp() { pubnub.History() .Channel(subChannel) .Count(100) .End(lastMessageTimestamp) .IncludeTimetoken(true) .Async((result, status) => { if (status.Error) { if (debug) { Debug.LogError(displayName + status.ErrorData.Info); } RaiseHandleMessage(true, null, handleMessageCallback, status.ErrorData.Ex); } else { foreach (PNHistoryItemResult histItem in result.Messages) { Dictionary <string, object> msg = histItem.Entry as Dictionary <string, object>; if (debug) { Debug.Log(displayName + "New message from history"); } lastMessageTimestamp = histItem.Timetoken + 1; RaiseHandleMessage(false, msg, handleMessageCallback); } } }); }
void ButtonHistoryHandler() { pubnub.History().Channel("channel1").IncludeTimetoken(true).IncludeMeta(true).Async((result, status) => { if (status.Error) { Debug.Log(string.Format("In Example, History Error: {0} {1} {2}", status.StatusCode, status.ErrorData, status.Category)); } else { foreach (PNHistoryItemResult histItem in result.Messages) { Debug.Log(string.Format("histItem: {0}, {1}", histItem.Entry.ToString(), histItem.Timetoken.ToString())); Display(string.Format("histItem: {0}, {1}", histItem.Entry.ToString(), histItem.Timetoken.ToString())); } } }); }