As far as I understand the current IPFS pubsub implementation works only between nodes that are directly connected and as such can’t be used in production enviroments where that isn’t the case.
The current pubsub implementation will forward messages. That is, if peers A, B, and C are all subscribed to a topic and are connected in a line A <-> B <-> C
, B will forward pubsub messages on the topic between peers A and C. However, the current implementation is horribly inefficient (it’s called floodsub because it literally broadcasts the message to all connected and interested peers). We’re working on better message routing but that will take a while.
Another issue is pubsub peer discovery. When subscribing to a topic, one would ideally make some effort to find and connect to other peers subscribed to the same topic. go-ipfs does this (although it does so in a bit of a hacky way) however, js-ipfs doesn’t (as far as I know).
Note: If you were asking when arbitrary nodes will forward pubsub messages on topics to which they are not subscribed, this will likely never happen (although it may become possible to pay third parties to act as pubsub relays for your topic). Unrestricted relays are too easily abused.