diff --git a/nodejs.js b/nodejs.js
old mode 100644
new mode 100755
index cc94b4b..148526d
--- a/nodejs.js
+++ b/nodejs.js
@@ -53,6 +53,21 @@ Drupal.Nodejs.runSetupHandlers = function (type) {
   });
 };
 
+// Send sessionId for AJAX requests so we can exclude
+// the current browser window from resulting notifications if desired
+Drupal.Nodejs.connectionSetupHandlers.ajaxMonkeyPatch = {
+  connect: function (message) {  
+    // store original
+    var originalBeforeSerialize = Drupal.ajax.prototype.beforeSerialize;
+    
+    // monkey patch
+    Drupal.ajax.prototype.beforeSerialize = function(element_settings, options) {
+      options.data['nodejs_sessionid'] = Drupal.Nodejs.socket.socket.sessionid;
+      return originalBeforeSerialize(element_settings, options);
+    };
+  }
+};
+
 Drupal.Nodejs.connect = function () {
   var scheme = Drupal.settings.nodejs.secure ? 'https' : 'http',
       url = scheme + '://' + Drupal.settings.nodejs.host + ':' + Drupal.settings.nodejs.port;
diff --git a/nodejs.module b/nodejs.module
old mode 100644
new mode 100755
index 45a0408..303700a
--- a/nodejs.module
+++ b/nodejs.module
@@ -98,7 +98,7 @@ function nodejs_set_user_presence_list($uid, array $uids) {
  * @param string $subject
  * @param string $body
  */
-function nodejs_broadcast_message($subject, $body) {
+function nodejs_broadcast_message($subject, $body, $exclude_active_sessionid = FALSE) {
   $message = (object) array(
     'broadcast' => TRUE,
     'data' => (object) array(
@@ -106,6 +106,7 @@ function nodejs_broadcast_message($subject, $body) {
       'body' => $body,
     ),
     'channel' => 'nodejs_notify',
+    'exclude_sessionid' => $exclude_active_sessionid ? $_REQUEST['nodejs_sessionid'] : NULL,
   );
   nodejs_enqueue_message($message);
 }
diff --git a/nodejs.rules.inc b/nodejs.rules.inc
index e69de29..8be9501 100755
--- a/nodejs.rules.inc
+++ b/nodejs.rules.inc
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Implementation of hook_rules_action_info().
+ */
+function nodejs_rules_action_info() {
+  $items = array(
+    'nodejs_rules_action_notify' => array(
+      'label' => t('Publish realtime notification'),
+      'group' => 'nodejs',
+      'parameter' => array(
+        'subject' => array(
+          'type' => 'text',
+          'label' => t('Subject'),
+        ),
+        'body' => array(
+          'type' => 'text',
+          'label' => t('Body'),
+        ),
+        'exclude_active_sessionid' => array(
+          'type' => 'boolean',
+          'label' => t('Don\'t notify the the browser window that triggered this action'),
+        ),
+      ),
+    ),
+  );
+  return $items;
+}
+
+function nodejs_rules_action_notify($subject, $body, $exclude_active_sessionid) {
+  nodejs_broadcast_message($subject, $body, $exclude_active_sessionid);
+}
\ No newline at end of file
diff --git a/server.js b/server.js
old mode 100644
new mode 100755
index bbc8801..e8e953e
--- a/server.js
+++ b/server.js
@@ -294,8 +294,14 @@ var publishMessage = function (request, response) {
       if (backendSettings.debug) {
         console.log('Broadcasting message');
       }
-      io.sockets.json.send(message);
-      sentCount = io.sockets.sockets.length;
+      for (var sessionId in io.sockets.sockets) {
+        if (sessionId == message.exclude_sessionid) {
+          continue;
+        }
+        
+        io.sockets.socket(sessionId).json.send(message);
+        sentCount++;
+      }
     }
     else {
       sentCount = publishMessageToChannel(message);
@@ -319,6 +325,10 @@ var publishMessageToChannel = function (message) {
 
   var clientCount = 0;
   for (var sessionId in channels[message.channel].sessionIds) {
+    if (sessionId == message.exclude_sessionid) {
+      continue;
+    }
+    
     if (publishMessageToClient(sessionId, message)) {
       clientCount++;
     }
@@ -359,6 +369,10 @@ var publishMessageToContentChannel = function (request, response) {
     }
 
     for (var socketId in tokenChannels[message.channel].sockets) {
+      if (socketId == message.exclude_sessionid) {
+        continue;
+      }
+      
       publishMessageToClient(socketId, message);
     }
     response.send({sent: 'sent'});
