var FancyWebSocket=function(e){var b={};this.bind=function(a,f){b[a]=b[a]||[];b[a].push(f);return this};this.unbind=function(a){delete b[a];return this};this.send=function(a,b){this.conn.send(b);return this};this.connect=function(){null!=this.conn&&(delete this.conn,this.conn=null);console.log("## .connect ##");this.conn="function"==typeof MozWebSocket?new MozWebSocket(e):new WebSocket(e);this.conn.onmessage=function(a){c("message",a.data)};this.conn.onclose=function(){console.log("## .onclose ##");
c("close",this)};this.conn.onopen=function(){console.log("## .onopen ##");c("open",null)}};this.disconnect=function(){null!=this.conn&&(console.log("## .disconnect ##"),c("close",this.conn),this.conn.close())};var c=function(a,c){a=b[a];if("undefined"!=typeof a)for(var d=0;d<a.length;d++)a[d](c)}};
