Fixed an issue where emit() doesn't work due to the JSON encoding being an incorrect format for SocketIO