Q:

What is the difference between a socket that simply emits and one that volatile emits?

This is a follow-up question to the question below;
Why does this updateSockets() function accept a parameter that look like this?
In the code below, the socket uses volatile to emit.
var updateSockets = function(data) {
  // adding the time of the last update
  data.time = new Date();
  console.log('Pushing new data to the clients connected ( connections amount = %s ) - %s', connectionsArray.length , data.time);
  // sending new data to all the sockets connected
  connectionsArray.forEach(function(tmpSocket) {
    tmpSocket.volatile.emit('notification', data);
  });
};

What if the code is changed such that it becomes tmpSocket.emit('notification', data);? What is the difference between tmpSocket.volatile.emit('notification', data); and tmpSocket.emit('notification', data);?

A:

From the Socket.io docs:

Sending volatile messages
Sometimes certain messages can be dropped.
Let’s say you have an app that shows realtime tweets for the keyword
bieber.
If a certain client is not ready to receive messages (because of
network slowness or other issues, or because they’re connected through
long polling and is in the middle of a request-response cycle), if
they doesn’t receive ALL the tweets related to bieber your application
won’t suffer.
In that case, you might want to send those messages as volatile
messages.

Essentially, if you don't care if the client receives the data, then send it as volatile.

