crossbario / crossbario/autobahn-python

Documentation about async callbacks

Open
#1,105 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

asyncio docs enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.