Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SseChannel.prototype.send = function(msg, clients) {
- var message = parseMessage(msg, this.jsonEncode);
- if (!clients) {
- // Remove duplicate entries from the history
- if (msg.id) {
- this.history = reject(this.history, { id: msg.id });
- }
- // Add the message to history (if not a "private" message)
- var entry = { id: msg.id, msg: message };
- if (msg.id && this.history.unshift(entry) > this.historySize) {
- this.history.pop();
- }
- }
- broadcast(clients || this.connections, message);
- this.emit('message', this, msg, clients || this.connections);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement