What is the significance of the first argument of broadcast and subscribe?
What is a scenario where the first argument would be something different other than App.PubSub ? In the docs this argument is described simply as “The name of the pubsub system”.
From my perspective this is just boilerplate and I would like to know a situation where it would change.
Take a look at your application.ex. PubSub is started there and given a name. That‘s required wherever you interact with that system. You could have many separate pubsub systems with different names.
As @LostKobrakai mentions, it is the name under which your Phoenix.PubSub process is registered.
This is YourApp.PubSub by convention. When you have multiple apps in a cluster, you start a Phoenix.PubSub in each app, with identical names, then all these instances talk to each other.
I recently wrote a small article about this on my blog.