Change the behavior and implementation of middleware to require separate callback once the socket is ready for messages to be sent to it.