在parse.com上为消息传递应用程序存储发送消息历史记录吗? [英] Storing send message history on parse.com for a messaging app?

查看:65
本文介绍了在parse.com上为消息传递应用程序存储发送消息历史记录吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将parse.com用于我的后端消息传递应用程序.我现在正要显示聊天记录"或消息历史记录.在解析时存储消息历史记录的最佳方法是什么? 一个新类来存储已发送的消息,还是与已发送的消息建立PFRelation?

I am using parse.com for my backend for a messaging sort of app. I am at a part now where I want to show a 'chat log' or message history. What is the best way to store a message history on parse? A new class to store sent messages, or a PFRelation to a message that has been send?

如果有人有任何想法,我很想听听他们的想法.

If anyone has any ideas, I'd love to hear them.

推荐答案

您可以为每个对话创建一个Chat对象,并将每个消息存储在一个指针数组中.因此,发送消息后,可以将其添加到聊天数组中.

You could create a Chat object for each conversation, and store every message in an array of pointers. So when your message is sent, you add it to the chat array.

显示聊天记录就像查询正确的聊天对象一样简单(使用includeKey作为指针数组键,它将与聊天对象一起获取所有消息),然后直接显示消息.

Showing a chat log will then be as easy as querying for the correct Chat object (using includeKey for the pointer array key, which will fetch all the messages together with the Chat object) and then showing the messages directly.

这篇关于在parse.com上为消息传递应用程序存储发送消息历史记录吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆