如何在 GAE 中实现 Facebook Post Type 对象?
我是一名新程序员,试图在我的应用程序中实现 Facebook 类型的“提要”。就像每当用户在他的个人资料中进行一些更改时,他链接的个人资料就会以新闻源的形式知道。
但我坚持这一点,因为我认为每当任何用户保存任何数据(如“新闻”、“博客”、“事件”或任何“评论”)时,只需将相应类的 id 发送到链接的配置文件,他们就会看到它。由于 id 不是在保存对象之前生成的,所以问题是如何发送它们。我想到了以下解决方法,但每个方法都有一些问题。
每当用户发布新闻时......将创建一个 Post 对象并将其添加到用户的帖子集合中。 但是其他用户如何知道它......
1)向他们发送 id .... 但是当未创建 id 时,你如何向他们发送 id。
2) 向他们发送帖子消息,当他们点击它们时...将显示特定用户发给他们的最新帖子..但如果超过 3 条消息,那么将显示哪些消息?按帖子创建日期显示,不会显示大于该日期的帖子....但需要向他显示较新的帖子..
3) 将帖子保存在所有关注者源中。数据会比4)大得多,
所有登录的关注者都会检查他们关注的所有人员,并在时间戳后保存他们的提要?如何实现这一点,因为帖子保存在用户的个人资料中,因此我必须检查以下所有人员,然后只需检查提要并将其显示在他的提要框中;我想我必须使用批处理。处理将需要更长的时间。
我正在使用 objectify-appengine 在 GAE 上进行操作。
任何帮助表示赞赏
I a new programmer and trying to implement a facebook type "feed" in my application. Like Whenever a user do some changes in his profile his linked profiles will get to know that in the form of news feed.
But I am stuck on that as I thought whenever any user saves any data (like "News", "Blog", "Event" or any "Comment") just send the id of the respective classes to the linked profiles and they will see it. Since the id is not generated before the object is saved , the problem is how can I send them. I thought of following workarounds but each have some problem.
Whenever a user posts a news .... a Post object will be made and added to User's Post Collection.
But How do the other users will knew about it.....
1) Send them the id .... but when the id is not created how can you send them the id.
2) Send them the post message and when ever they will click them ... the latest post to them from the particular user will be shown.. but if more than 3 messages then which will be shown?? Shown by the post creation Date no post greater than that date is shownn....but he needs to be shown newer posts..
3) Save the post in all followers feed. the data will be much larger then
4) all the followers on login will check all the persons they are following and save their feed after the time stamp? How to implement this as the Post is saved in User's Profile so I would have to check all the following person and then just check the feed and show them on his feed box; I think I would have to use batch Processes. Processing will take much longer.
I am using objectify-appengine to do operations on GAE.
Any help is appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否想像 Facebook 和 Twitter 一样实时更新页面的帖子?要在 Google App Engine 上实现此目的,您可以使用Channel API ,它与 Javascript 结合使用来监听新数据并更新 DOM。
Are you wanting to update the page with posts in real time like on Facebook and Twitter? To achieve this on Google App Engine you can use the Channel API, which works in conjunction with Javascript to listen for new data and update the DOM.
Brett Slatkin 在 Google I/O 2009 上的这篇演讲准确描述了您应该为此使用的模式。
This talk at Google I/O 2009 by Brett Slatkin describes exactly the pattern you should use for this.