[Groonga-commit] groonga/express-kotoumi [master] Emit event with envelope.type for published message

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Wed Feb 13 17:56:24 JST 2013


YUKI Hiroshi	2013-02-13 17:56:24 +0900 (Wed, 13 Feb 2013)

  New Revision: 963e18540442ae92fc179304810bc3cf03cbec61
  https://github.com/groonga/express-kotoumi/commit/963e18540442ae92fc179304810bc3cf03cbec61

  Log:
    Emit event with envelope.type for published message

  Modified files:
    lib/backend/connection.js
    lib/frontend/socket.io-adaptor.js

  Modified: lib/backend/connection.js (+1 -0)
===================================================================
--- lib/backend/connection.js    2013-02-13 17:26:21 +0900 (d634add)
+++ lib/backend/connection.js    2013-02-13 17:56:24 +0900 (1b5e88f)
@@ -75,6 +75,7 @@ function isSuccess(code) {
 
 Connection.prototype._handleMessage = function(envelope) {
   this.emit('message', envelope);
+  this.emit(envelope.type, envelope.body);
 
   var inReplyTo = envelope.inReplyTo;
   if (inReplyTo) {

  Modified: lib/frontend/socket.io-adaptor.js (+3 -3)
===================================================================
--- lib/frontend/socket.io-adaptor.js    2013-02-13 17:26:21 +0900 (31d2f23)
+++ lib/frontend/socket.io-adaptor.js    2013-02-13 17:56:24 +0900 (afe074e)
@@ -70,11 +70,11 @@ exports.register = function(application, server, params) {
   }
 
   function createPublishedMessageHandler(commandName, socket) {
-    return (function(envelope) {
+    return (function(body) {
       var commandDefinition = unifiedCommandSet[commandName];
 
-      var event = envelope.type;
-      var data = envelope.body;
+      var event = commandName;
+      var data = body;
 
       if (commandDefinition.toClient) {
         var result = commandDefinition.toClient(event, data);
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る