lib/faye-browser.js in faye-1.1.0 vs lib/faye-browser.js in faye-1.1.1
- old
+ new
@@ -1,10 +1,10 @@
(function() {
'use strict';
var Faye = {
- VERSION: '1.1.0',
+ VERSION: '1.1.1',
BAYEUX_VERSION: '1.0',
ID_LENGTH: 160,
JSONP_CALLBACK: 'jsonpcallback',
CONNECTION_TYPES: ['long-polling', 'cross-origin-long-polling', 'callback-polling', 'websocket', 'eventsource', 'in-process'],
@@ -1528,11 +1528,10 @@
this.connectionType = transport.connectionType;
}, this);
},
sendMessage: function(message, timeout, options) {
- if (!this._transport) return;
options = options || {};
var id = message.id,
attempts = options.attempts,
deadline = options.deadline && new Date().getTime() + (options.deadline * 1000),
@@ -1546,10 +1545,11 @@
this._sendEnvelope(envelope);
},
_sendEnvelope: function(envelope) {
+ if (!this._transport) return;
if (envelope.request || envelope.timer) return;
var message = envelope.message,
scheduler = envelope.scheduler,
self = this;
@@ -1728,10 +1728,11 @@
this._flush();
if (last) this._outbox.push(last);
},
_receive: function(replies) {
+ if (!replies) return;
replies = [].concat(replies);
this.debug('Client ? received from ? via ?: ?',
this._dispatcher.clientId, Faye.URI.stringify(this.endpoint), this.connectionType, replies);
@@ -2563,12 +2564,12 @@
create: function(dispatcher, endpoint) {
var sockets = dispatcher.transports.eventsource = dispatcher.transports.eventsource || {},
id = dispatcher.clientId;
- endpoint = Faye.copyObject(endpoint);
- endpoint.pathname += '/' + (id || '');
- var url = Faye.URI.stringify(endpoint);
+ var url = Faye.copyObject(endpoint);
+ url.pathname += '/' + (id || '');
+ url = Faye.URI.stringify(url);
sockets[url] = sockets[url] || new this(dispatcher, endpoint);
return sockets[url];
}
});
\ No newline at end of file