Is the heartbeat occurring too frequently? Have you considered using the "connect" event instead? It may serve your needs better:
connect: (url, options, connectCallback) =>
someFunction = =>
@doSomeRedisStuff() if @connected
@logger.debug "starting connection to url: #{url}"
@socket = @socket.connect(url, options)
@logger.debug "connecting ..."
@socket.on "connect", =>
@logger.info "connected (socket id #{(@socket.socket.sessionid)})"
@connected = true
setTimeout someFunction, 2000
connectCallback() if connectCallback?
@socket.on "disconnect", =>
@connected = false
In case of a server interruption (such as a restart), the connect event will trigger upon reestablishing the connection. Socket.IO handles this seamlessly.