[Groonga-commit] droonga/express-droonga at 7d3d889 [master] Send a line break for each notification

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jan 6 18:22:58 JST 2014


YUKI Hiroshi	2014-01-06 18:22:58 +0900 (Mon, 06 Jan 2014)

  New Revision: 7d3d889385dafaf5565c9850dfda91e9430362cd
  https://github.com/droonga/express-droonga/commit/7d3d889385dafaf5565c9850dfda91e9430362cd

  Message:
    Send a line break for each notification

  Modified files:
    lib/adapter/command.js

  Modified: lib/adapter/command.js (+8 -1)
===================================================================
--- lib/adapter/command.js    2014-01-06 17:29:08 +0900 (7459726)
+++ lib/adapter/command.js    2014-01-06 18:22:58 +0900 (2a00470)
@@ -134,6 +134,12 @@ HTTPStreaming.extend = function(targetClass) {
   Object.defineProperty(targetClass.prototype, 'notification', {
     get: function() { return this._options.notification; }
   });
+  Object.defineProperty(targetClass.prototype, 'delimiter', {
+    get: function() { return this._options.delimiter || targetClass.defaultDelimiter; }
+  });
+  if (!targetClass.defaultDelimiter)
+    targetClass.defaultDelimiter = '\n';
+
   Object.defineProperty(targetClass.prototype, 'createSubscription', {
     get: function() { return this._options.createSubscription; }
   });
@@ -147,8 +153,9 @@ HTTPStreaming.extend = function(targetClass) {
       'Transfer-Encoding': 'chunked'
     });
 
+    var delimiter = this.delimiter;
     connection.on(this.notification, function(data) {
-      response.write(JSON.stringify(data));
+      response.write(JSON.stringify(data) + delimiter);
     });
 
     var subscriptionMessage = this.createSubscription(request);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index