YUKI Hiroshi
null+****@clear*****
Thu Oct 17 16:33:57 JST 2013
YUKI Hiroshi 2013-10-17 16:33:57 +0900 (Thu, 17 Oct 2013) New Revision: 82532040c6c87143dda673fdd94affb18f3f0c4d https://github.com/droonga/express-droonga/commit/82532040c6c87143dda673fdd94affb18f3f0c4d Message: Create notification listener on every subscribing Modified files: lib/adapter/socket.io.js Modified: lib/adapter/socket.io.js (+4 -4) =================================================================== --- lib/adapter/socket.io.js 2013-10-17 16:21:51 +0900 (130b8c6) +++ lib/adapter/socket.io.js 2013-10-17 16:33:57 +0900 (49c3417) @@ -173,13 +173,13 @@ exports.register = function(application, server, params) { var subscribeEvent = registeredCommand.name + '.subscribe'; var unsubscribeEvent = registeredCommand.name + '.unsubscribe'; var notificationEvent = registeredCommand.name + '.notification'; - var notificationHandler = createNotificationHandler(notificationEvent, socket); var subscriveHandler = createClientMessageHandler(subscribeEvent, socket, function() { if (handlers[notificationEvent]) return; - connection.on(notificationEvent, notificationHandler); - handlers[notificationEvent] = notificationHandler; + var handler = createNotificationHandler(notificationEvent, socket); + connection.on(notificationEvent, handler); + handlers[notificationEvent] = handler; }); if (subscriveHandler) socket.on(subscribeEvent, subscriveHandler); @@ -187,7 +187,7 @@ exports.register = function(application, server, params) { var unsubscribeHandler = createClientMessageHandler(unsubscribeEvent, socket, function() { if (!handlers[notificationEvent]) return; - connection.removeListener(notificationEvent, notificationHandler); + connection.removeListener(notificationEvent, handlers[notificationEvent]); delete handlers[notificationEvent]; }); if (unsubscribeHandler) -------------- next part -------------- HTML����������������������������... Download