【发布时间】:2016-10-25 22:06:37
【问题描述】:
我在我的 react 本机应用程序中使用 pubnub api 并拨打电话以获取消息历史记录,如下所示:
pubnub.history({
channel: channel,
count: 15,
includeTimetoken: false,
start: props.lastMessageTimestamp
},
function(status, response){
console.log(response);
if (!status.error){
props.addHistory(response);
}
}
);
出于某种原因,我总是收到随每条消息返回的时间令牌。默认情况下,即使我指定不返回时间令牌。知道这里发生了什么吗?这是一个示例响应:
{ messages:
{ messages:
[ { timetoken: null,
entry:
{ text: 'This is a message',
user: { _id: 1 },
createdAt: '2016-10-25T18:56:50.205Z',
_id: 'temp-id-958468' } },
{ timetoken: null,
entry:
{ text: 'Message',
user: { _id: 1 },
createdAt: '2016-10-25T18:57:45.810Z',
_id: 'temp-id-322242' } },
{ timetoken: null,
entry:
{ text: 'Test',
user: { _id: 1 },
createdAt: '2016-10-25T21:25:43.290Z',
_id: 'temp-id-806299' } },
{ timetoken: null,
entry:
{ text: 'Text',
user: { _id: 1 },
createdAt: '2016-10-25T21:34:41.204Z',
_id: 'temp-id-399187' } } ],
startTimeToken: 14774207865431668,
endTimeToken: 14774312812443264 },
timestamp: undefined }
【问题讨论】:
标签: javascript react-native pubnub