coroutine based method for staying connected