Refactor the socket.io support in the kernel