SocketCluster / socketcluster-client

JavaScript client for SocketCluster
MIT License
291 stars 92 forks source link

When emitting/publishing event, if socket is disconnected, clone data before adding it to pending buffer #70

Closed jondubois closed 7 years ago

jondubois commented 7 years ago

This is to avoid potential inconsistency is behaviour between connected vs disconnected sockets when publishing an object and modifying it shortly afterwards (while it's sitting in the buffer).

Also this should be done in sc-broker as well: https://github.com/SocketCluster/sc-broker/blob/master/index.js#L262L266

jondubois commented 7 years ago

This was implemented - If you set the cloneData option to true when creating the socket.