Refactor ioloop into a class to better encapsulate the data and support multiple connections in the future. Enqueue messages instead of sending potentially in parallel.