Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with asyncio #123

Open
dendendd opened this issue Jun 26, 2017 · 1 comment
Open

Usage with asyncio #123

dendendd opened this issue Jun 26, 2017 · 1 comment

Comments

@dendendd
Copy link

Working on a project where we want to both receive telegram messages and respond to user inputs

Wanted to see if there's a good way to incorporate this using coroutines / asyncio i.e. maybe wrap both the message_loop and user input polling in asyncio.async functions to manage concurrency

asyncio.async(user_input())
asyncio.async(message_loop())
asyncio.get_event_loop().run_forever()

Have done a bunch of test programs but getting stuck on reworking the stacked calls with receiver.message(message_loop(sender))... doesn't seem to like yielding control so far

Any ideas?

@luckydonald
Copy link
Owner

The message_loop function is a coroutine, if that helps you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants