节点。基于事件的comet的周期性ajax请求?

时间:2021-04-24 20:57:03

Core features of node.js as far as I understood are (also): event-based structure and very cheap "threads" sleeping. So, it may be really good idea (and probably cheaper) to do not create periodic ajax requests, but to hold events like "user A got a new message" and let user's A connection thread sleep until this event happens.

核心功能的节点。在我看来,js(也是):基于事件的结构和非常便宜的“线程”休眠。因此,最好不要创建周期性的ajax请求(可能也更便宜),而是保存“用户A获得新消息”之类的事件,并让用户的连接线程休眠直到事件发生。

How do you think - what would be cheaper for server (RAM, CPU) to use?

你怎么想——对于服务器(RAM, CPU)来说,什么会更便宜?

1 个解决方案

#1


3  

Take a look at socket.io for pushing data. It really is very good.

看看插座。io推动数据。真的很好。

#1


3  

Take a look at socket.io for pushing data. It really is very good.

看看插座。io推动数据。真的很好。