Comparing version 0.2.4 to 0.2.5
Changelog | ||
====== | ||
Version 0.2.5 | ||
--- | ||
May 5, 2012 | ||
* Add 'reconnect', 'reconnectDelay', 'reconnectMaxAttempts' to browser client options | ||
* Add 'reconnecting', 'reconnectError' to browser client events | ||
* Add 'isReconnecting' method to browser client | ||
Version 0.2.4 | ||
@@ -15,3 +23,3 @@ --- | ||
* Fix browser isArray implementation | ||
* Fix browser 'isArray' implementation | ||
* Fix XHR transport choice schema | ||
@@ -18,0 +26,0 @@ * Fix WebSocket transport |
@@ -754,28 +754,21 @@ /* | ||
transports : [ 'webSocket', 'longPolling', 'JSONPLongPolling' ] | ||
transports : [ 'webSocket', 'longPolling', 'JSONPLongPolling' ], | ||
reconnect : true, | ||
reconnectDelay : 1000, | ||
reconnectMaxAttempts : 20 | ||
}, options); | ||
this._io = null; | ||
this.router = new BesedaPackage.Router(this); | ||
this.clientId = null; | ||
this._io = new BesedaPackage.IO(this.__options); | ||
this.__status = BesedaPackage.Client.__statuses.DISCONNECTED; | ||
this.__messageQueue = []; | ||
this.__channels = []; | ||
this.__connectionRequestMessage = null; | ||
this.__reconnectTimeout = null; | ||
this.__reconnectAttemptsCount = 0; | ||
this.router = new BesedaPackage.Router(this); | ||
this.clientId = null; | ||
this._init(); | ||
}; | ||
BesedaPackage.utils.inherits(BesedaPackage.Client, BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses = { | ||
DISCONNECTED : 0, | ||
CONNECTING : 1, | ||
CONNECTED : 2 | ||
}; | ||
BesedaPackage.Client.prototype._init = function() { | ||
this._io = new BesedaPackage.IO(this.__options); | ||
var self = this; | ||
@@ -787,20 +780,28 @@ this._io.addListener('message', function(message) { | ||
this._io.addListener('error', function() { | ||
self.__destroy(); | ||
self.__destroy(); | ||
setTimeout(function(){ | ||
self.connect(undefined, undefined, undefined, self.__firstMessage); | ||
}, 5000) | ||
if (self.__options.reconnect) { | ||
self.__reconnect(); | ||
} | ||
}); | ||
this.__firstMessage = null; | ||
this.__handleConnectionClosure = function(connectionID) { | ||
self.clientId = connectionID; | ||
var message = self.__createMessage('/meta/connect', self.__firstMessage); | ||
self.__resetReconnection(); | ||
var message = self.__createMessage('/meta/connect', self.__connectionRequestMessage); | ||
self._io.send(message); | ||
//self.__firstMessage = null; | ||
}; | ||
}; | ||
BesedaPackage.utils.inherits(BesedaPackage.Client, BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses = { | ||
DISCONNECTED : 0, | ||
CONNECTING : 1, | ||
CONNECTED : 2 | ||
}; | ||
BesedaPackage.Client.prototype.isConnected = function() { | ||
@@ -818,2 +819,7 @@ return this.__status == BesedaPackage.Client.__statuses.CONNECTED; | ||
BesedaPackage.Client.prototype.isReconnecting = function() { | ||
return this.__reconnectTimeout !== null; | ||
} | ||
BesedaPackage.Client.prototype.subscribe = function(channel, callback, additionalMessage) { | ||
@@ -876,16 +882,15 @@ if (this.isDisconnected()) { | ||
/** | ||
* | ||
* @param {string=} host | ||
* @param {number=} port | ||
* @param {boolean=} ssl | ||
* @param {Object=} message | ||
*/ | ||
BesedaPackage.Client.prototype.connect = function(host, port, ssl, message) { | ||
//TODO: Do somethinng when connecting | ||
if (!this.isConnected()) { | ||
if (!this.isConnected() || !this.isConnecting()) { | ||
if (this.isReconnecting()) { | ||
this.__resetReconnection(); | ||
} | ||
this.__status = BesedaPackage.Client.__statuses.CONNECTING; | ||
this.__firstMessage = message; | ||
//TODO: Nothing happen if another connet listener appear | ||
if (message !== undefined) { | ||
this.__connectionRequestMessage = message; | ||
} | ||
//TODO: Nothing happen if another connect listener appear | ||
if (!this._io.listeners('connect').length) { | ||
@@ -910,2 +915,3 @@ this._io.on('connect', this.__handleConnectionClosure); | ||
this.__destroy(); | ||
this.__resetReconnection(); | ||
@@ -920,2 +926,35 @@ this.emit('disconnect'); | ||
BesedaPackage.Client.prototype.setConnectionMessage = function(message) { | ||
this.__connectionRequestMessage = message; | ||
}; | ||
BesedaPackage.Client.prototype.__reconnect = function() { | ||
if (this.isReconnecting()) { | ||
return false; | ||
} | ||
if (this.__options.reconnectMaxAttempts > this.__reconnectAttemptsCount) { | ||
this.__reconnectAttemptsCount++; | ||
var self = this, | ||
delay = this.__options.reconnectDelay * this.__reconnectAttemptsCount; | ||
this.emit('reconnecting', this.__reconnectAttemptsCount, delay); | ||
this.__reconnectTimeout = setTimeout(function() { | ||
self.__reconnectTimeout = null; | ||
self.connect(); | ||
}, delay); | ||
} else { | ||
this.__reconnectAttemptsCount = 0; | ||
this.emit('reconnectError'); | ||
} | ||
}; | ||
BesedaPackage.Client.prototype.__resetReconnection = function() { | ||
this.__reconnectAttemptsCount = 0; | ||
clearTimeout(this.__reconnectTimeout); | ||
this.__reconnectTimeout = null; | ||
}; | ||
BesedaPackage.Client.prototype.__destroy = function() { | ||
@@ -952,3 +991,2 @@ this.__status = BesedaPackage.Client.__statuses.DISCONNECTED; | ||
BesedaPackage.Client.prototype.__flushMessageQueue = function() { | ||
@@ -1475,4 +1513,6 @@ for (var i = 0; i < this.__messageQueue.length; i++) { | ||
BesedaPackage.transport.WebSocket.prototype.__handleClose = function(event) { | ||
this._handleError(event); | ||
this.disconnect(); | ||
if (this._isConnected) { | ||
this._handleError(event); | ||
this.disconnect(); | ||
} | ||
}; | ||
@@ -1479,0 +1519,0 @@ |
@@ -18,11 +18,13 @@ var JSON;JSON||(JSON={}); | ||
BesedaPackage.utils.__base64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split("");BesedaPackage.utils.__base64charsLength=BesedaPackage.utils.__base64chars.length;BesedaPackage.utils.uid=function(a){for(var a=a||10,b=0,c=[];b<a;b++)c[b]=BesedaPackage.utils.__base64chars[0|Math.random()*BesedaPackage.utils.__base64charsLength];return c.join("")}; | ||
BesedaPackage.Client=function(a){BesedaPackage.events.EventEmitter.prototype.constructor.call(this);this.__options=BesedaPackage.utils.mergeObjects({host:document.location.hostname,port:4E3,ssl:!1,transports:["webSocket","longPolling","JSONPLongPolling"]},a);this._io=null;this.__status=BesedaPackage.Client.__statuses.DISCONNECTED;this.__messageQueue=[];this.__channels=[];this.router=new BesedaPackage.Router(this);this.clientId=null;this._init()};BesedaPackage.utils.inherits(BesedaPackage.Client,BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses={DISCONNECTED:0,CONNECTING:1,CONNECTED:2}; | ||
BesedaPackage.Client.prototype._init=function(){this._io=new BesedaPackage.IO(this.__options);var a=this;this._io.addListener("message",function(b){a.router.dispatch(b)});this._io.addListener("error",function(){a.__destroy();setTimeout(function(){a.connect(void 0,void 0,void 0,a.__firstMessage)},5E3)});this.__firstMessage=null;this.__handleConnectionClosure=function(b){a.clientId=b;b=a.__createMessage("/meta/connect",a.__firstMessage);a._io.send(b)}}; | ||
BesedaPackage.Client.prototype.isConnected=function(){return this.__status==BesedaPackage.Client.__statuses.CONNECTED};BesedaPackage.Client.prototype.isDisconnected=function(){return this.__status==BesedaPackage.Client.__statuses.DISCONNECTED};BesedaPackage.Client.prototype.isConnecting=function(){return this.__status==BesedaPackage.Client.__statuses.CONNECTING}; | ||
BesedaPackage.Client.prototype.subscribe=function(a,b,c){this.isDisconnected()&&this.connect();var d=c||{};d.subscription=a;var d=this.__sendMessage("/meta/subscribe",d),e=this;this.once("subscribe:"+d.id,function(b){b||(e.__channels[a]=d)});if(b)this.once("subscribe:"+d.id,b)}; | ||
BesedaPackage.Client=function(a){BesedaPackage.events.EventEmitter.prototype.constructor.call(this);this.__options=BesedaPackage.utils.mergeObjects({host:document.location.hostname,port:4E3,ssl:!1,transports:["webSocket","longPolling","JSONPLongPolling"],reconnect:!0,reconnectDelay:1E3,reconnectMaxAttempts:20},a);this.router=new BesedaPackage.Router(this);this.clientId=null;this._io=new BesedaPackage.IO(this.__options);this.__status=BesedaPackage.Client.__statuses.DISCONNECTED;this.__messageQueue= | ||
[];this.__channels=[];this.__reconnectTimeout=this.__connectionRequestMessage=null;this.__reconnectAttemptsCount=0;var b=this;this._io.addListener("message",function(a){b.router.dispatch(a)});this._io.addListener("error",function(){b.__destroy();b.__options.reconnect&&b.__reconnect()});this.__handleConnectionClosure=function(a){b.clientId=a;b.__resetReconnection();a=b.__createMessage("/meta/connect",b.__connectionRequestMessage);b._io.send(a)}};BesedaPackage.utils.inherits(BesedaPackage.Client,BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses={DISCONNECTED:0,CONNECTING:1,CONNECTED:2};BesedaPackage.Client.prototype.isConnected=function(){return this.__status==BesedaPackage.Client.__statuses.CONNECTED};BesedaPackage.Client.prototype.isDisconnected=function(){return this.__status==BesedaPackage.Client.__statuses.DISCONNECTED};BesedaPackage.Client.prototype.isConnecting=function(){return this.__status==BesedaPackage.Client.__statuses.CONNECTING}; | ||
BesedaPackage.Client.prototype.isReconnecting=function(){return this.__reconnectTimeout!==null};BesedaPackage.Client.prototype.subscribe=function(a,b,c){this.isDisconnected()&&this.connect();var d=c||{};d.subscription=a;var d=this.__sendMessage("/meta/subscribe",d),e=this;this.once("subscribe:"+d.id,function(b){b||(e.__channels[a]=d)});if(b)this.once("subscribe:"+d.id,b)}; | ||
BesedaPackage.Client.prototype.unsubscribe=function(a,b,c){this.isDisconnected()&&this.connect();c=c||{};c.subscription=a;var c=this.__sendMessage("/meta/unsubscribe",c),d=this;this.once("unsubscribe:"+c.id,function(b){b||delete d.__channels[a]});if(b)this.once("unsubscribe:"+c.id,b)};BesedaPackage.Client.prototype.publish=function(a,b,c){this.isDisconnected()&&this.connect();b=this.__sendMessage(a,{data:b});if(c)this.once("publish:"+b.id,c)}; | ||
BesedaPackage.Client.prototype.connect=function(a,b,c,d){if(!this.isConnected()){this.__status=BesedaPackage.Client.__statuses.CONNECTING;this.__firstMessage=d;if(!this._io.listeners("connect").length)this._io.on("connect",this.__handleConnectionClosure);this._io.connect(a,b,c);for(var e in this.__channels)this.__sendMessage("/meta/subscribe",this.__channels[e])}};BesedaPackage.Client.prototype.disconnect=function(){this._io.disconnect();this.__channels=[];this.__destroy();this.emit("disconnect")}; | ||
BesedaPackage.Client.prototype.applyConnection=function(){this.__status=BesedaPackage.Client.__statuses.CONNECTED;this.__flushMessageQueue()};BesedaPackage.Client.prototype.__destroy=function(){this.__status=BesedaPackage.Client.__statuses.DISCONNECTED;this.clientId=null;this.__messageQueue=[]};BesedaPackage.Client.prototype.__sendMessage=function(a,b){if(!this.isDisconnected())return b=this.__createMessage(a,b),this.isConnecting()?this.__messageQueue.push(b):this._io.send(b),b}; | ||
BesedaPackage.Client.prototype.__createMessage=function(a,b){b=b||{};b.id=BesedaPackage.utils.uid();b.channel=a;b.clientId=this.clientId;return b};BesedaPackage.Client.prototype.__flushMessageQueue=function(){for(var a=0;a<this.__messageQueue.length;a++)this.__messageQueue[a].clientId=this.clientId;this._io.send(this.__messageQueue);this.__messageQueue=[]};var Beseda=BesedaPackage.Client;BesedaPackage.Router=function(a){this.__client=a}; | ||
BesedaPackage.Client.prototype.connect=function(a,b,c,d){if(!this.isConnected()||!this.isConnecting()){this.isReconnecting()&&this.__resetReconnection();this.__status=BesedaPackage.Client.__statuses.CONNECTING;if(d!==void 0)this.__connectionRequestMessage=d;if(!this._io.listeners("connect").length)this._io.on("connect",this.__handleConnectionClosure);this._io.connect(a,b,c);for(var e in this.__channels)this.__sendMessage("/meta/subscribe",this.__channels[e])}}; | ||
BesedaPackage.Client.prototype.disconnect=function(){this._io.disconnect();this.__channels=[];this.__destroy();this.__resetReconnection();this.emit("disconnect")};BesedaPackage.Client.prototype.applyConnection=function(){this.__status=BesedaPackage.Client.__statuses.CONNECTED;this.__flushMessageQueue()};BesedaPackage.Client.prototype.setConnectionMessage=function(a){this.__connectionRequestMessage=a}; | ||
BesedaPackage.Client.prototype.__reconnect=function(){if(this.isReconnecting())return!1;if(this.__options.reconnectMaxAttempts>this.__reconnectAttemptsCount){this.__reconnectAttemptsCount++;var a=this,b=this.__options.reconnectDelay*this.__reconnectAttemptsCount;this.emit("reconnecting",this.__reconnectAttemptsCount,b);this.__reconnectTimeout=setTimeout(function(){a.__reconnectTimeout=null;a.connect()},b)}else this.__reconnectAttemptsCount=0,this.emit("reconnectError")}; | ||
BesedaPackage.Client.prototype.__resetReconnection=function(){this.__reconnectAttemptsCount=0;clearTimeout(this.__reconnectTimeout);this.__reconnectTimeout=null};BesedaPackage.Client.prototype.__destroy=function(){this.__status=BesedaPackage.Client.__statuses.DISCONNECTED;this.clientId=null;this.__messageQueue=[]}; | ||
BesedaPackage.Client.prototype.__sendMessage=function(a,b){if(!this.isDisconnected())return b=this.__createMessage(a,b),this.isConnecting()?this.__messageQueue.push(b):this._io.send(b),b};BesedaPackage.Client.prototype.__createMessage=function(a,b){b=b||{};b.id=BesedaPackage.utils.uid();b.channel=a;b.clientId=this.clientId;return b}; | ||
BesedaPackage.Client.prototype.__flushMessageQueue=function(){for(var a=0;a<this.__messageQueue.length;a++)this.__messageQueue[a].clientId=this.clientId;this._io.send(this.__messageQueue);this.__messageQueue=[]};var Beseda=BesedaPackage.Client;BesedaPackage.Router=function(a){this.__client=a}; | ||
BesedaPackage.Router.prototype.dispatch=function(a){if(a.channel==void 0||a.clientId==void 0||a.id==void 0)this.__client.emit("error","Beseda receive incorrect message",a);else if(a.channel.indexOf("/meta/")==0){var b=a.channel.substr(6);!b in["connect","error","subscribe","unsubscribe"]?this.__client.emit("error","Unsupported meta channel "+a.channel,a):this["_"+b].call(this,a)}else"successful"in a?this._publish(a):this._message(a)}; | ||
@@ -52,3 +54,3 @@ BesedaPackage.Router.prototype._connect=function(a){a.successful?(this.__client.applyConnection(),this.__client.emit("connect",a)):(this.__client.disconnect(),this.__client.emit("error","Beseda connection request declined",a))};BesedaPackage.Router.prototype._error=function(a){this.__client.emit("error",a.data,a)}; | ||
BesedaPackage.transport.WebSocket.prototype.disconnect=function(){this.__ws.close();this._isConnected=this.__handshaked=!1};BesedaPackage.transport.WebSocket.prototype._doSend=function(a){this.__ws.send(a)};BesedaPackage.transport.WebSocket.prototype.__handleOpen=function(){this._isConnected=!0}; | ||
BesedaPackage.transport.WebSocket.prototype.__handleData=function(a){a=this._decodeData(a.data);this.__handshaked?BesedaPackage.Transport.prototype._handleMessages.call(this,a):(this.__handshaked=!0,BesedaPackage.Transport.prototype._handleConnection.call(this,a.connectionId))};BesedaPackage.transport.WebSocket.prototype.__handleClose=function(a){this._handleError(a);this.disconnect()}; | ||
BesedaPackage.transport.WebSocket.prototype.__handleData=function(a){a=this._decodeData(a.data);this.__handshaked?BesedaPackage.Transport.prototype._handleMessages.call(this,a):(this.__handshaked=!0,BesedaPackage.Transport.prototype._handleConnection.call(this,a.connectionId))};BesedaPackage.transport.WebSocket.prototype.__handleClose=function(a){this._isConnected&&(this._handleError(a),this.disconnect())}; | ||
BesedaPackage.transport.request.XHRRequest=function(a,b){BesedaPackage.events.EventEmitter.prototype.constructor.call(this);this._isXDomain=b;this.url=null;this.method=a;this.data=null}; | ||
@@ -55,0 +57,0 @@ BesedaPackage.transport.request.XHRRequest.createRequest=function(a){var b=null;window.XMLHttpRequest&&(!a||(new XMLHttpRequest).withCredentials!=void 0)?b=new XMLHttpRequest:window.XDomainRequest&&a?(b=new XDomainRequest,b.onprocess=function(){}):window.ActiveXObject&&!a&&(b=new ActiveXObject("Microsoft.XMLHTTP"));return b};BesedaPackage.utils.inherits(BesedaPackage.transport.request.XHRRequest,BesedaPackage.events.EventEmitter); |
@@ -14,28 +14,21 @@ | ||
transports : [ 'webSocket', 'longPolling', 'JSONPLongPolling' ] | ||
transports : [ 'webSocket', 'longPolling', 'JSONPLongPolling' ], | ||
reconnect : true, | ||
reconnectDelay : 1000, | ||
reconnectMaxAttempts : 20 | ||
}, options); | ||
this._io = null; | ||
this.router = new BesedaPackage.Router(this); | ||
this.clientId = null; | ||
this._io = new BesedaPackage.IO(this.__options); | ||
this.__status = BesedaPackage.Client.__statuses.DISCONNECTED; | ||
this.__messageQueue = []; | ||
this.__channels = []; | ||
this.__connectionRequestMessage = null; | ||
this.__reconnectTimeout = null; | ||
this.__reconnectAttemptsCount = 0; | ||
this.router = new BesedaPackage.Router(this); | ||
this.clientId = null; | ||
this._init(); | ||
}; | ||
BesedaPackage.utils.inherits(BesedaPackage.Client, BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses = { | ||
DISCONNECTED : 0, | ||
CONNECTING : 1, | ||
CONNECTED : 2 | ||
}; | ||
BesedaPackage.Client.prototype._init = function() { | ||
this._io = new BesedaPackage.IO(this.__options); | ||
var self = this; | ||
@@ -47,20 +40,28 @@ this._io.addListener('message', function(message) { | ||
this._io.addListener('error', function() { | ||
self.__destroy(); | ||
self.__destroy(); | ||
setTimeout(function(){ | ||
self.connect(undefined, undefined, undefined, self.__firstMessage); | ||
}, 5000) | ||
if (self.__options.reconnect) { | ||
self.__reconnect(); | ||
} | ||
}); | ||
this.__firstMessage = null; | ||
this.__handleConnectionClosure = function(connectionID) { | ||
self.clientId = connectionID; | ||
var message = self.__createMessage('/meta/connect', self.__firstMessage); | ||
self.__resetReconnection(); | ||
var message = self.__createMessage('/meta/connect', self.__connectionRequestMessage); | ||
self._io.send(message); | ||
//self.__firstMessage = null; | ||
}; | ||
}; | ||
BesedaPackage.utils.inherits(BesedaPackage.Client, BesedaPackage.events.EventEmitter); | ||
BesedaPackage.Client.__statuses = { | ||
DISCONNECTED : 0, | ||
CONNECTING : 1, | ||
CONNECTED : 2 | ||
}; | ||
BesedaPackage.Client.prototype.isConnected = function() { | ||
@@ -78,2 +79,7 @@ return this.__status == BesedaPackage.Client.__statuses.CONNECTED; | ||
BesedaPackage.Client.prototype.isReconnecting = function() { | ||
return this.__reconnectTimeout !== null; | ||
} | ||
BesedaPackage.Client.prototype.subscribe = function(channel, callback, additionalMessage) { | ||
@@ -136,16 +142,15 @@ if (this.isDisconnected()) { | ||
/** | ||
* | ||
* @param {string=} host | ||
* @param {number=} port | ||
* @param {boolean=} ssl | ||
* @param {Object=} message | ||
*/ | ||
BesedaPackage.Client.prototype.connect = function(host, port, ssl, message) { | ||
//TODO: Do somethinng when connecting | ||
if (!this.isConnected()) { | ||
if (!this.isConnected() || !this.isConnecting()) { | ||
if (this.isReconnecting()) { | ||
this.__resetReconnection(); | ||
} | ||
this.__status = BesedaPackage.Client.__statuses.CONNECTING; | ||
this.__firstMessage = message; | ||
//TODO: Nothing happen if another connet listener appear | ||
if (message !== undefined) { | ||
this.__connectionRequestMessage = message; | ||
} | ||
//TODO: Nothing happen if another connect listener appear | ||
if (!this._io.listeners('connect').length) { | ||
@@ -170,2 +175,3 @@ this._io.on('connect', this.__handleConnectionClosure); | ||
this.__destroy(); | ||
this.__resetReconnection(); | ||
@@ -180,2 +186,35 @@ this.emit('disconnect'); | ||
BesedaPackage.Client.prototype.setConnectionMessage = function(message) { | ||
this.__connectionRequestMessage = message; | ||
}; | ||
BesedaPackage.Client.prototype.__reconnect = function() { | ||
if (this.isReconnecting()) { | ||
return false; | ||
} | ||
if (this.__options.reconnectMaxAttempts > this.__reconnectAttemptsCount) { | ||
this.__reconnectAttemptsCount++; | ||
var self = this, | ||
delay = this.__options.reconnectDelay * this.__reconnectAttemptsCount; | ||
this.emit('reconnecting', this.__reconnectAttemptsCount, delay); | ||
this.__reconnectTimeout = setTimeout(function() { | ||
self.__reconnectTimeout = null; | ||
self.connect(); | ||
}, delay); | ||
} else { | ||
this.__reconnectAttemptsCount = 0; | ||
this.emit('reconnectError'); | ||
} | ||
}; | ||
BesedaPackage.Client.prototype.__resetReconnection = function() { | ||
this.__reconnectAttemptsCount = 0; | ||
clearTimeout(this.__reconnectTimeout); | ||
this.__reconnectTimeout = null; | ||
}; | ||
BesedaPackage.Client.prototype.__destroy = function() { | ||
@@ -212,3 +251,2 @@ this.__status = BesedaPackage.Client.__statuses.DISCONNECTED; | ||
BesedaPackage.Client.prototype.__flushMessageQueue = function() { | ||
@@ -215,0 +253,0 @@ for (var i = 0; i < this.__messageQueue.length; i++) { |
@@ -88,6 +88,8 @@ | ||
BesedaPackage.transport.WebSocket.prototype.__handleClose = function(event) { | ||
this._handleError(event); | ||
this.disconnect(); | ||
if (this._isConnected) { | ||
this._handleError(event); | ||
this.disconnect(); | ||
} | ||
}; | ||
@@ -1,2 +0,2 @@ | ||
var connection = new Beseda(); | ||
var connection = new Beseda({transports : ['longPolling', 'JSONPLongPolling' ]}); | ||
@@ -7,2 +7,10 @@ connection.on('connect', function(message) { | ||
connection.on('reconnectError', function() { | ||
BesedaPackage.utils.log('Beseda reconnect error!'); | ||
}); | ||
connection.on('reconnecting', function(attemt, delay) { | ||
BesedaPackage.utils.log('Beseda reconnectiong ' + attemt + ' time after ' + delay + ' milliseconds'); | ||
}); | ||
connection.on('disconnect', function() { | ||
@@ -9,0 +17,0 @@ BesedaPackage.utils.log('Beseda disconnected'); |
{ | ||
"name": "beseda", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Beseda is fast, well designed and featured Pub/Sub server. Beseda offers multiple platform API to develop realtime web applications.", | ||
@@ -5,0 +5,0 @@ "keywords" : ["pub/sub", "commet", "bayeux", "realtime", "push", "WebSocket"], |
5390552
133
13216