crossbario / crossbario/autobahn-python
Documentation about async callbacks
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
While facing with #1104, I realised that the callbacks in the websocket protocol may be coroutines. So, instead of
class Protocol(WebSocketServerProtocol):
def onOpen(self):
asyncio.ensure_future(coro(), loop=loop)
one could write
class Protocol(WebSocketServerProtocol):
async def onOpen(self):
await coro
The difference is there's no way to specify a loop, but the opportunity to use coroutines is very important yet undocumented.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the documentation for WebSocketServerProtocol callbacks and the onOpen entry point, using issue #1104 for context. Document that callbacks may be async coroutines and show the coroutine form, including the limitation that it cannot specify an event loop; done means the supported behavior is clear in the relevant documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100