Skip to content

Conversation

edgurgel
Copy link

Hi there!

I've started a discussion in the Elixir forum about this change but then I noticed that the change in the end was pretty straightforward so I decided to open a PR as well.

If someone is using a non-standard metadata when subscribing to the topic it’s not possible to specify a custom dispatcher module. It will always use the Phoenix.Channel.Server.dispatch/3 function.

At Realtime we use a custom metadata but our custom dispatcher can't be used as Phoenix.Presence always use Phoenix.Channel.Server as dispatcher. We considered having our own Presence module but it felt heavy handed given that we only needed a custom dispatcher in the end.

Can totally understand if we don't want to expose this as a function but I thought I would try anyway 😅

use Phoenix.Presence,
otp_app: :my_app,
pubsub_server: MyApp.PubSub,
dispatcher: MyApp.CustomDispatcher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some documentation or links on what is the dispatch and how a custom implementation would look like. I don't know if we want to link to the endpoint, Elixir's Registry or what else, but we just need a bit more context here. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one tiny nit!

@edgurgel edgurgel force-pushed the feat/presence-custom-dispatcher branch from 48b5f51 to 331fcac Compare October 5, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants