PubSub
Build on the fundamentals of PubSub by selecting the topic in this lesson.
We'll cover the following...
Selecting a topic name
A carefully selected topic name is vital for the scalability and behavior of an application. For instance, a public Channel providing inventory updates to an e-commerce storefront could be implemented in a variety of ways:
inventory
: This topic does not delineate between different .SKUs Stock Keeping Units inventory:*
: This topic delineates between different item with a wildcard.SKUs Stock Keeping Units
If an overly broad topic is selected, such as inventory
, then an inventory change to an SKU is broadcast to every connected client, even if they are not viewing the item. A narrower topic such as inventory:*
would lead to more connected topics (one per viewed item) but means that outgoing data could be held back from clients that aren’t viewing a particular SKU.
In this example, we would select a ...