2013-08-07 14:21
浏览 130

使用nodejs + socket.io和mysql聊天

So I want to develop a chat system based on nodejs and, I have made a prototype and it works, the only thing that is stuck in my mind is how to store the chat messages in the database.

I guess is not a good idea to store a message when a user hits the enter button, because this is live chat you could have 1000 just from a user in 30-60 min.

The question is WHEN to store the data in the database, because I don't think that storing right away when the user hits enter will work on the long term?

The chat works on the same idea as facebook.

图片转代码服务由CSDN问答提供 功能建议

所以我想开发一个基于nodejs和socket.io的聊天系统,我做了一个原型,它的工作原理 ,我唯一想到的就是如何将聊天消息存储在数据库中。

当用户点击输入按钮时,我猜想存储消息不是一个好主意。 ,因为这是实时聊天,你可以在30-60分钟内从用户那里获得1000个。

问题是什么时候将数据存储在数据库中,因为我不认为 当用户点击输入时立即存储将长期工作?


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题