Permalink
Browse files

transports: implemented new parser

  • Loading branch information...
1 parent bdaff4e commit f5cf2243ec055c874d54b967e51792f896613159 @rauchg rauchg committed Mar 16, 2013
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/transports/polling.js
View
@@ -170,15 +170,16 @@ Polling.prototype.onDataRequest = function (req, res) {
Polling.prototype.onData = function (data) {
debug('received "%s"', data);
- var packets = parser.decodePayload(data);
- for (var i = 0, l = packets.length; i < l; i++) {
+ var self = this;
+ parser.decodePayload(data, function(){
if ('close' == packets[i].type) {
debug('got xhr close packet');
- return this.onClose();
+ this.onClose();
+ return false;
}
- this.onPacket(packets[i]);
- }
+ self.onPacket(packets[i]);
+ });
};
/**

0 comments on commit f5cf224

Please sign in to comment.