lib/js/websocketio.js in sinatra-websocketio-0.2.2 vs lib/js/websocketio.js in sinatra-websocketio-0.2.3

- old
+ new

@@ -12,15 +12,15 @@ self.session = session_id; self.emit("connect", self.session); }); this.connect = function(){ - if(typeof WebSocket === 'undefined'){ + if(typeof WebSocket !== "function"){ self.emit("error", "websocket not exists in this browser"); return null; } self.running = true; - var url = self.session ? self.url+'/session='+self.session : self.url; + var url = self.session ? self.url+"/session="+self.session : self.url; self.websocket = new WebSocket(url); self.websocket.onmessage = function(e){ try{ var data_ = JSON.parse(e.data); self.emit(data_.type, data_.data);