diff --git a/lib/transports/polling.js b/lib/transports/polling.js
index <HASH>..<HASH> 100644
--- a/lib/transports/polling.js
+++ b/lib/transports/polling.js
@@ -135,17 +135,20 @@ Polling.prototype.onData = function(data){
 
     // otherwise bypass onData and handle the message
     self.onPacket(packet);
+  });
 
+  // if an event did not trigger closing
+  if ('closed' != this.readyState) {
     // if we got data we're not polling
-    self.polling = false;
-    self.emit('pollComplete');
+    this.polling = false;
+    this.emit('pollComplete');
 
-    if ('open' == self.readyState) {
-      self.poll();
+    if ('open' == this.readyState) {
+      this.poll();
     } else {
-      debug('ignoring poll - transport state "%s"', self.readyState);
+      debug('ignoring poll - transport state "%s"', this.readyState);
     }
-  });
+  }
 };
 
 /**
polling: consider the possibility of an event changing readyState