how to restart a coroutine when a resource updates #2339
w3irdrobot
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i have some code setting up a websocket-like client that is
async
that i then want to use inside a coroutine. my reason for this is setting up a client that can be heavy. so i'd like to set it up once and then be able to use it in the coroutine. my thought was to check if the resource isSome
. if not, it exits the coroutine. otherwise it continue to my business logic. however, the coroutine only runs once, at the beginning of the program. it makes sense to some extent that it wouldn't work the way i was thinking, but i'm looking for a pattern that will work for me. would using an enum as the messages on the coroutine's channel be the suggested way to pass in some of client?an example of what i'd like to do.
Beta Was this translation helpful? Give feedback.
All reactions