Re-written to use Socket.io 1.x s new middleware api