-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Payload option for Channel.join() function #136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Maturin - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -36,23 +36,27 @@ def __init__(self, socket: Socket, topic: str, params: Dict[str, Any] = {}) -> N | |||
self.listeners: List[CallbackListener] = [] | |||
self.joined = False | |||
|
|||
def join(self) -> Channel: | |||
def join(self, payload: Dict[str, Any] = {}) -> Channel: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code_clarification): Consider documenting the default behavior when 'payload' is not provided.
It might be helpful for users of this method to understand what the default payload behavior entails, especially if it affects the channel's state or interaction with the server.
return self | ||
|
||
async def _join(self) -> None: | ||
async def _join(self, payload: Dict[str, Any]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code_refinement): Parameter 'payload' in '_join' should be optional to match the public 'join' method.
Making 'payload' optional in '_join' ensures that calls without a payload do not fail and maintains consistency with the public interface.
async def _join(self, payload: Dict[str, Any]) -> None: | |
async def _join(self, payload: Optional[Dict[str, Any]] = None) -> None: |
:param payload: Optional, additional payload, which is sent to the | ||
server, when a channel is joined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code_clarification): Clarify the impact of the 'payload' on the server's response or channel state.
Expanding on how the payload affects the server's handling of the join request or the state of the channel could provide clearer guidance to developers using this method.
:param payload: Optional, additional payload, which is sent to the | |
server, when a channel is joined. | |
:param payload: Optional, additional payload, which is sent to the | |
server when a channel is joined. This payload can be used | |
to pass extra data or preferences that might influence how | |
the server processes the join request or manages the channel's | |
state. For example, it could specify initial settings or | |
roles for the user in the channel. |
This pull requested needs to be merged with PR #135. |
What kind of change does this PR introduce?
Implement the #134 feature request.
What is the current behavior?
#134
What is the new behavior?
When calling the
join
function, one can specify an additional payload respectively parameters.Additional context
n/a