crossbario / crossbario/autobahn-python
Document overriding with ApplicationSession
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
The docs show some examples of using wamp.ApplicationSession, e.g., at https://github.com/tavendo/AutobahnPython/blob/master/examples/asyncio/wamp/rpc/timeservice/frontend.py
Neither of the two methods (onJoin and onDisconnect) calls the equivalent method in the super class. That happens to be ok (at least for now) because the super class implementations don't do anything. But the examples can lead the reader to forget about / ignore the super class. So, for example, a beginner might write their own onLeave and not call super().onLeave() with just a print statement in it. That results in the transport never being disconnected.
I think things would be clearer if the super methods were called, even though they don't currently do anything.
Unfortunately if you call super.onChallenge though, you get an exception, which is not logged to the terminal :-( So it's not always a good idea to call the super method. But hopefully by the time people are writing their own authenticators they'll have more of an idea what they're doing.
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 with examples/asyncio/wamp/rpc/timeservice/frontend.py and review how its onJoin and onDisconnect methods relate to wamp.ApplicationSession. Check the surrounding ApplicationSession examples and the discussion of onLeave and onChallenge. Done means the examples consistently clarify when superclass methods should be called without suggesting an unsafe onChallenge call.
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
- 35/100