comet 服务器推技术 node服务端问题 急急急 在线等
javascript
客户端代码: function longConnect(){ var source = new EventSource('/contact/comet'); source.onmessage=function(event) { console.log(2); console.log(event.data); }; } 服务端代码 exports.comet = function(req, res, next){ res.set('Content-Type', 'text/event-stream'); setInterval(function(){ res.send("1"); },3000); };
报错:
http.js:690
throw new Error('Can\'t set headers after they are sent.');
不能重复设置 那express框架下该怎么做?
呆零小猫娘
9 years, 4 months ago