SocketIO volatile emit to namespace

The following is failing with the error TypeError: Cannot read property 'volatile' of undefined (i.e. map doesn't have a volatile emit method):

io = require("socket.io").listen(server)
map = io.of "/map"

temp = []

recieveDataFromSomewhere = (hit) ->
  temp.push hit

setInterval ->
    map.volatile.emit 'data', temp
    temp = []
, 1000

I need to use volatile messages as the overhead of SocketIO keeping track of receipts is causing latency to rise problematically over time.

Not sure if you can emit volatile messages to the namespace. Try emitting to the socket connected on the namespace.

var io = require("socket.io").listen(server);

var map = io.of("/map");

map.on("connection", function(socket) {
    socket.volatile.emit('data');
});

If you want to send to all connected clients you could do something like:

Object.keys(io.nsps['/map'].connected).forEach(function(socketID) {
    io.nsps['/map'].connected[socketID].volatile.emit('data')
});