Assigns a callback functions that will be called
periodically. It can be used by the application to check if
there is remaining application data that needs to be sent
or if there are connections that need to be closed.