Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserf committed Jul 19, 2016
1 parent dc0264d commit 1274390
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## [1.0.1] - 2016-07-19

### Bug Fixes

- Fixed issue where deleted record was not getting removed

## [1.0.0] - 2016-07-10

### Features
Expand Down
44 changes: 22 additions & 22 deletions dist/deepstream.js
Expand Up @@ -4991,18 +4991,18 @@ EventHandler.prototype.subscribe = function( eventName, callback ) {
*/
EventHandler.prototype.unsubscribe = function( eventName, callback ) {
this._emitter.off( eventName, callback );

if( !this._emitter.hasListeners( eventName ) ) {
this._ackTimeoutRegistry.add( eventName, C.ACTIONS.UNSUBSCRIBE );
this._connection.sendMsg( C.TOPIC.EVENT, C.ACTIONS.UNSUBSCRIBE, [ eventName ] );
}
};

/**
* Emits an event locally and sends a message to the server to
* Emits an event locally and sends a message to the server to
* broadcast the event to the other connected clients
*
* @param {String} name
* @param {String} name
* @param {Mixed} data will be serialized and deserialized to its original type.
*
* @public
Expand Down Expand Up @@ -5080,7 +5080,7 @@ EventHandler.prototype._$handle = function( message ) {
this._ackTimeoutRegistry.clear( message );
return;
}

if( message.action === C.ACTIONS.ERROR ) {
message.processedError = true;
this._client._$onError( C.TOPIC.EVENT, message.data[ 0 ], message.data[ 1 ] );
Expand Down Expand Up @@ -5148,7 +5148,7 @@ var Connection = function( client, url, options ) {

/**
* Returns the current connection state.
* (One of constants.CONNECTION_STATE)
* (One of constants.CONNECTION_STATE)
*
* @public
* @returns {String} connectionState
Expand Down Expand Up @@ -5181,7 +5181,7 @@ Connection.prototype.authenticate = function( authParams, callback ) {
this._deliberateClose = false;
return;
}

if( this._state === C.CONNECTION_STATE.AWAITING_AUTHENTICATION ) {
this._sendAuthParams();
}
Expand Down Expand Up @@ -5221,7 +5221,7 @@ Connection.prototype.send = function( message ) {
this._currentMessageResetTimeout = utils.nextTick( this._resetCurrentMessageCount.bind( this ) );
}

if( this._state === C.CONNECTION_STATE.OPEN &&
if( this._state === C.CONNECTION_STATE.OPEN &&
this._queuedMessages.length < this._options.maxMessagesPerPacket &&
this._currentPacketMessageCount < this._options.maxMessagesPerPacket ) {
this._sendQueuedMessages();
Expand Down Expand Up @@ -5341,7 +5341,7 @@ Connection.prototype._sendAuthParams = function() {

/**
* Will be invoked once the connection is established. The client
* can't send messages yet, and needs to get a connection ACK or REDIRECT
* can't send messages yet, and needs to get a connection ACK or REDIRECT
* from the server before authenticating
*
* @private
Expand Down Expand Up @@ -5394,7 +5394,7 @@ Connection.prototype._onClose = function() {
}
else if( this._deliberateClose === true ) {
this._setState( C.CONNECTION_STATE.CLOSED );
}
}
else {
if( this._originalUrl !== this._url ) {
this._url = this._originalUrl;
Expand Down Expand Up @@ -5442,7 +5442,7 @@ Connection.prototype._onMessage = function( message ) {
* by the client until the authentication is successful.
*
* If a challenge is recieved, the user will send the url to the server
* in response to get the appropriate redirect. If the URL is invalid the
* in response to get the appropriate redirect. If the URL is invalid the
* server will respond with a REJECTION resulting in the client connection
* being permanently closed.
*
Expand All @@ -5457,15 +5457,15 @@ Connection.prototype._onMessage = function( message ) {
Connection.prototype._handleConnectionResponse = function( message ) {
var data;

if( message.action === C.ACTIONS.ACK ) {
if( message.action === C.ACTIONS.ACK ) {
this._setState( C.CONNECTION_STATE.AWAITING_AUTHENTICATION );
if( this._authParams ) {
this._sendAuthParams();
}
}
}
else if( message.action === C.ACTIONS.CHALLENGE ) {
this._setState( C.CONNECTION_STATE.CHALLENGING );
this._endpoint.send( messageBuilder.getMsg( C.TOPIC.CONNECTION, C.ACTIONS.CHALLENGE_RESPONSE, [ this._originalUrl ] ) );
this._endpoint.send( messageBuilder.getMsg( C.TOPIC.CONNECTION, C.ACTIONS.CHALLENGE_RESPONSE, [ this._originalUrl ] ) );
}
else if( message.action === C.ACTIONS.REJECTION ) {
this._challengeDenied = true;
Expand Down Expand Up @@ -5493,21 +5493,21 @@ Connection.prototype._handleAuthResponse = function( message ) {
var data;

if( message.action === C.ACTIONS.ERROR ) {

if( message.data[ 0 ] === C.EVENT.TOO_MANY_AUTH_ATTEMPTS ) {
this._deliberateClose = true;
this._tooManyAuthAttempts = true;
} else {
this._setState( C.CONNECTION_STATE.AWAITING_AUTHENTICATION );
}

if( this._authCallback ) {
this._authCallback( false, this._getAuthData( message.data[ 1 ] ) );
}

} else if( message.action === C.ACTIONS.ACK ) {
this._setState( C.CONNECTION_STATE.OPEN );

if( this._authCallback ) {
this._authCallback( true, this._getAuthData( message.data[ 0 ] ) );
}
Expand All @@ -5534,7 +5534,7 @@ Connection.prototype._getAuthData = function( data ) {
};

/**
* Updates the connection state and emits the
* Updates the connection state and emits the
* connectionStateChanged event on the client
*
* @private
Expand All @@ -5551,7 +5551,7 @@ Connection.prototype._setState = function( state ) {
*
* If the number of failed reconnection attempts exceeds
* options.maxReconnectAttempts the connection is closed
*
*
* @private
* @returns {void}
*/
Expand All @@ -5564,7 +5564,7 @@ Connection.prototype._tryReconnect = function() {
this._setState( C.CONNECTION_STATE.RECONNECTING );
this._reconnectTimeout = setTimeout(
this._tryOpen.bind( this ),
this._options.reconnectIntervalIncrement * this._reconnectionAttempt
this._options.reconnectIntervalIncrement * this._reconnectionAttempt
);
this._reconnectionAttempt++;
} else {
Expand All @@ -5575,7 +5575,7 @@ Connection.prototype._tryReconnect = function() {

/**
* Attempts to open a errourosly closed connection
*
*
* @private
* @returns {void}
*/
Expand Down Expand Up @@ -6533,7 +6533,7 @@ RecordHandler.prototype.getRecord = function( name, recordOptions ) {
this._records[ name ] = new Record( name, recordOptions || {}, this._connection, this._options, this._client );
this._records[ name ].on( 'error', this._onRecordError.bind( this, name ) );
this._records[ name ].on( 'destroyPending', this._onDestroyPending.bind( this, name ) );
this._records[ name ].on( 'deleted', this._removeRecord.bind( this, name ) );
this._records[ name ].on( 'delete', this._removeRecord.bind( this, name ) );
this._records[ name ].on( 'discard', this._removeRecord.bind( this, name ) );
}

Expand Down
4 changes: 2 additions & 2 deletions dist/deepstream.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "deepstream.io-client-js",
"version": "1.0.0",
"version": "1.0.1",
"description": "the javascript client for deepstream.io",
"main": "src/client.js",
"directories": {
Expand Down

0 comments on commit 1274390

Please sign in to comment.