简体   繁体   English

如何构建一个自毁的聊天应用服务器?

[英]How to build a self destructing chat app server?

I'm making a chat app server with self destructing chat room feature.我正在制作一个具有自毁聊天室功能的聊天应用服务器。 I have to reset the timer after the last chat, and when the timer runs out I have to blow up the chat room.最后一次聊天后我必须重置计时器,当计时器用完时,我必须炸毁聊天室。 The important thing is that I have to send push notifications to users when the chat room is gone, and to record the deletion time in the DB(PostgreSQL).重要的是我必须在聊天室消失时向用户发送推送通知,并在数据库(PostgreSQL)中记录删除时间。

I tried to use Redis' expire, but I'm not sure it is possible to implement the push service.我尝试使用 Redis 的 expire ,但不确定是否可以实现推送服务。 I should also consider that my server must be able to scale out.我还应该考虑我的服务器必须能够横向扩展。 Do you have any good ideas?你有什么好主意吗?

Thank you very much.非常感谢。

  • you can use expire to schedule deletion of a chat room您可以使用 expire 来安排删除聊天室
  • you can use notify-keyspace-events and watch for expire message to send notifications to user and record deletion time to db (example: Listen for changes in redis list )您可以使用notify-keyspace-events并监视expire消息以向用户发送通知并将删除时间记录到数据库(例如: 监听 redis 列表中的更改
  • scaling should be easy with redis as it's quite mature使用 redis 进行缩放应该很容易,因为它非常成熟

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM