Skip to content
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 #134

Open
Maturin opened this issue May 5, 2024 · 0 comments
Open

Payload option for Channel.join() function #134

Maturin opened this issue May 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Maturin
Copy link

Maturin commented May 5, 2024

Feature request

Is your feature request related to a problem? Please describe.

For an integration project, I need to specify some additional payload, when joining a channel. Therefore, I'd like to enhance the Channel.join function for being able to pass a payload like this:

# common connection and channel setup

join_payload = { 
    "key1": value1,
    "key2": value2
}

channel.join(payload)

Describe the solution you'd like

The Channel._join function foresees already the usage of some payload:

        join_req = dict(topic=self.topic, event="phx_join",
                        payload={}, ref=None)

Therefore, I would add a payload parameter to the join functions, like this:

    def join(self, payload:dict = {}) -> Channel:
        # ...

    async def _join(self, payload:dict) -> None:
        # ...
        join_req = dict(topic=self.topic, event="phx_join",
                        payload=payload, ref=None)
        # ...

Describe alternatives you've considered

n/a

Additional context

This would also effect my ticket #133.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant