diff --git a/lib/transports/websocket.js b/lib/transports/websocket.js
index <HASH>..<HASH> 100644
--- a/lib/transports/websocket.js
+++ b/lib/transports/websocket.js
@@ -5,7 +5,7 @@
  * MIT Licensed
  */
 
-(function (exports, io) {
+(function (exports, io, global) {
 
   /**
    * Expose constructor.
@@ -60,7 +60,7 @@
     // end node
 
     if (!Socket) {
-      Socket = window.MozWebSocket || window.WebSocket;
+      Socket = global.MozWebSocket || global.WebSocket;
     }
 
     this.websocket = new Socket(this.prepareUrl() + query);
@@ -154,8 +154,8 @@
     // if node
     return true;
     // end node
-    return ('WebSocket' in window && !('__addTask' in WebSocket))
-          || 'MozWebSocket' in window;
+    return ('WebSocket' in global && !('__addTask' in WebSocket))
+          || 'MozWebSocket' in global;
   };
 
   /**
@@ -180,4 +180,5 @@
 })(
     'undefined' != typeof io ? io.Transport : module.exports
   , 'undefined' != typeof io ? io : module.parent.exports
+  , this
 );
Fixed; find WebSocket in global instead of window