Skip to content

Commit

Permalink
Refactoring listen registry
Browse files Browse the repository at this point in the history
  • Loading branch information
yasserf committed Aug 8, 2016
1 parent ae7ad98 commit 2336b8b
Show file tree
Hide file tree
Showing 5 changed files with 467 additions and 368 deletions.
20 changes: 10 additions & 10 deletions src/event/event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ EventHandler.prototype.handle = function( socketWrapper, message ) {
this._triggerEvent( socketWrapper, message );
}

else if( message.action === C.ACTIONS.LISTEN_SNAPSHOT ) {
this._listenerRegistry.sendSnapshot( socketWrapper, message );
}

else if( message.action === C.ACTIONS.LISTEN ) {
this._listenerRegistry.addListener( socketWrapper, message );
}

else if( message.action === C.ACTIONS.UNLISTEN ) {
this._listenerRegistry.removeListener( socketWrapper, message );
/*
* Listen to requests for a particular event or events
* whose names match a pattern
*/
else if( message.action === C.ACTIONS.LISTEN ||
message.action === C.ACTIONS.UNLISTEN ||
message.action === C.ACTIONS.LISTEN_ACCEPT ||
message.action === C.ACTIONS.LISTEN_REJECT ||
message.action === C.ACTIONS.LISTEN_SNAPSHOT) {
this._listenerRegistry.handle( socketWrapper, message );
}

else {
Expand Down
Loading

0 comments on commit 2336b8b

Please sign in to comment.