0

I have a database (MySQL) to which data is being written to. I need to push new records and changed records to UI. A few constraints here: I do not have control on the code which writes to this database and I cannot modify it to write to a queue.

So far, I am reading the DB periodically for changes and new additions (using a last update timestamp) and pushing that data to a mongo db (as I do not want to hit main MySQL server for every request). Then I push these changes to frontend using cramp (ruby framework) and server sent events. To maintain per user queue, I have redis in the mix.

I realize that this is a convulated way of doing realtime push. I was wondering if there is a more neat solution to this mess.

4

1 回答 1

-1

如果您想从服务器实时推送数据,请使用提供实时访问的技术。我建议您使用Websockets

唯一的问题是并非所有浏览器都支持 websockets,要解决这个问题,您可以使用基于 websockets 构建的可用框架,这些框架提供对浏览器支持的协议(如长轮询、流式传输等)的回退。以下是我的框架建议使用:

于 2012-10-04T04:56:28.750 回答