docs: function FakeWebSocket() {
  		var
  			self = this,
  			url = arguments[0],
  			protocols = arguments[1],
  			listeners = {};
  
  
  		// WebSocket is an EventTarget as per W3C spec.
  
  		this.addEventListener = function (type, newListener) {
  			var listenersType, i, listener;
  
  			if (!type || !newListener) {
  				return;
  			}
  
  			listenersType = listeners[type];
  			if (listenersType === undefined) {
  				listeners[type] = listenersType = [];
  			}
  
  			for (i = 0; !!(listener = listenersType[i]); i++) {
  				if (listener === newListener) {
  					return;
  				}
  			}
  
  			listenersType.push(newListener);
  		};
  
  		this.removeEventListener = function (type, oldListener) {
  			var listenersType, i, listener;
  
  			if (!type || !oldListener) {
  				return;
  			}
  
  			listenersType = listeners[type];
  			if (listenersType === undefined) {
  				return;
  			}
  
  			for (i = 0; !!(listener = listenersType[i]); i++) {
  				if (listener === oldListener) {
  					listenersType.splice(i, 1);
  					break;
  				}
  			}
  
  			if (listenersType.length === 0) {
  				delete listeners[type];
  			}
  		};
  
  		this.dispatchEvent = function (event) {
  			var
  				self = this,
  				type,
  				listenersType,
  				dummyListener,
  				stopImmediatePropagation = false,
  				i, listener;
  
  			if (!(event instanceof Event)) {
  				throw new Error('first argument must be an instance of Event');
  			}
  
  			type = event.type;
  
  			listenersType = (listeners[type] || []);
  
  			dummyListener = this['on' + type];
  			if (typeof dummyListener === 'function') {
  				listenersType.push(dummyListener);
  			}
  
  			event.target = this;
  
  			for (i = 0; !!(listener = listenersType[i]); i++) {
  				if (stopImmediatePropagation) {
  					break;
  				}
  
  				fire(listener, event);
  			}
  
  			return !event.defaultPrevented;
  
  			function fire(listener, event) {
  				// Avoid iOS WebSocket bug by running the listener within a setTimeout.
  				setTimeout(function () {
  					listener.call(self, event);
  				});
  			}
  		};
  
  		setTimeout(function () {
  			// Create a native WebSocket instance.
  			if (protocols) {
  				self.ws = new NativeWebSocket(url, protocols);
  			} else {
  				self.ws = new NativeWebSocket(url);
  			}
  
  			// Set the native WebSocket events.
  
  			self.ws.onopen = function (event) {
  				setTimeout(function () {
  					self.dispatchEvent(event);
  				});
  			};
  
  			self.ws.onerror = function (event) {
  				setTimeout(function () {
  					self.dispatchEvent(event);
  				});
  			};
  
  			self.ws.onclose = function (event) {
  				setTimeout(function () {
  					self.dispatchEvent(event);
  				});
  			};
  
  			self.ws.onmessage = function (event) {
  				setTimeout(function () {
  					self.dispatchEvent(event);
  				});
  			};
  		});
  	}