diff --git a/lib/hooks/pubsub/index.js b/lib/hooks/pubsub/index.js index 2e5233d0c9..5e3ded68b3 100644 --- a/lib/hooks/pubsub/index.js +++ b/lib/hooks/pubsub/index.js @@ -119,6 +119,9 @@ module.exports = function(sails) { */ broadcast: function(roomName, eventName, data, socketToOmit) { + if (data.previous && _.isFunction(data.previous.toJSON)) { + data.previous = _.clone(data.previous.toJSON(), true); + } sails.sockets.broadcast(roomName, eventName, data, socketToOmit); },