crossbario / crossbario/autobahn-python

Document overriding with ApplicationSession

Open
#457 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.