lib/storeRedis.js
function( userID, roomID ) {

		var userCount;

		if( roomUsers[ roomID ] === undefined ) {

			return promise.reject( 'No room with the id: ' + roomID );
		} else {

			var userIDX = roomUsers[ roomID ].indexOf( userID );

			if( userIDX != -1 ) {

				roomUsers[ roomID ].splice( userIDX, 1 );

				userCount = roomUsers[ roomID ].length;

				if( userCount == 0 ) {

					delete roomUsers[ roomID ];
				}

				return promise.resolve( userCount );
			} else {

				return promise.reject( 'User ' + userID + ' is not in the room: ' + roomID );
			}
		}
	}
function( userID, roomID ) {

		var userCount;

		if( roomUsers[ roomID ] === undefined ) {

			return promise.reject( 'No room with the id: ' + roomID );
		} else {

			var userIDX = roomUsers[ roomID ].indexOf( userID );

			if( userIDX != -1 ) {

				roomUsers[ roomID ].splice( userIDX, 1 );

				userCount = roomUsers[ roomID ].length;

				if( userCount == 0 ) {

					delete roomUsers[ roomID ];
				}

				return promise.resolve( userCount );
			} else {

				return promise.reject( 'User ' + userID + ' is not in the room: ' + roomID );
			}
		}
	}
function ( userID , roomID ) { var userCount ; if ( roomUsers [ roomID ] === undefined ) { return promise . reject ( 'No room with the id: ' + roomID ) ; } else { var userIDX = roomUsers [ roomID ] . indexOf ( userID ) ; if ( userIDX != - 1 ) { roomUsers [ roomID ] . splice ( userIDX , 1 ) ; userCount = roomUsers [ roomID ] . length ; if ( userCount == 0 ) { delete roomUsers [ roomID ] ; } return promise . resolve ( userCount ) ; } else { return promise . reject ( 'User ' + userID + ' is not in the room: ' + roomID ) ; } } }
Remove a user from a room

@param  {String} userID an id for the user whose leaving
@param  {String} roomID an id for the room the user is leaving
@return {Promise} When this promise resolves it will send the number of users in the room
Remove a user from a room