Event Bus

For our first subject in the Decoupling section of this book, we are going to review the Event Bus pattern. But first, we need to address the confusion that often arises between the definition of an Event Bus and its close cousin, the Event Queue. We can quickly boil down the core difference between both from their names.

A bus permits data to flow between different components, while a queue collects a list of data that needs processing at sequential intervals. And by this high-level definition of a bus, we can conclude that an Event Bus will focus on serving as a central hub for the publishing and broadcasting of events, and not as a queue of those events.

So, in this chapter, we will be focusing on building an Event Bus that will ...

Get Hands-On Game Development Patterns with Unity 2019 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.