returns an object that keeps track of current sessions. I guess I just need to continuously check the return of this function to see if there are no active sessions.
I solved the problem by adding a call back to the main context used for the server. Then I needed to add appropriate logic and functions to detect when client disconnects and to properly shutdown the infinite loop.