You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions should be coroutines which are defined with async def myfunc(): ...
Coroutines are called with await. For example await myfunc(). This is how asyncio allows many functions to take it in turns as they swap over when the current thread calls await.
Don't block the thread! If you need to make a call to a blocking function such as time.sleep() or any kind of IO request such as requests.get() then you should await an async variant. For example you can call await asyncio.sleep(10) to sleep without blocking the whole application and you can use aiohttp as an async url library.
The text was updated successfully, but these errors were encountered:
Let's add a Rocket.Chat connector as proposed in #498.
Steps
opsdroid.connector
calledrocketchat
and create an__init__.py
file inside.requirements.txt
with any new dependencies from the connector if necessary.Resources to get you started
Asyncio
Opsdroid uses asyncio and an event loop, so here are some things to bear in mind:
async def myfunc(): ...
await
. For exampleawait myfunc()
. This is how asyncio allows many functions to take it in turns as they swap over when the current thread callsawait
.time.sleep()
or any kind of IO request such asrequests.get()
then you shouldawait
an async variant. For example you can callawait asyncio.sleep(10)
to sleep without blocking the whole application and you can useaiohttp
as an async url library.The text was updated successfully, but these errors were encountered: