Advertisement
Guest User

Untitled

a guest
Oct 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SseChannel.prototype.send = function(msg, clients) {
  2.     var message = parseMessage(msg, this.jsonEncode);
  3.  
  4.     if (!clients) {
  5.         // Remove duplicate entries from the history
  6.         if (msg.id) {
  7.             this.history = reject(this.history, { id: msg.id });
  8.         }
  9.  
  10.         // Add the message to history (if not a "private" message)
  11.         var entry = { id: msg.id, msg: message };
  12.         if (msg.id && this.history.unshift(entry) > this.historySize) {
  13.             this.history.pop();
  14.         }
  15.     }
  16.  
  17.     broadcast(clients || this.connections, message);
  18.  
  19.     this.emit('message', this, msg, clients || this.connections);
  20. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement