Skip to content

Communication

Konnor Andrews edited this page Mar 3, 2018 · 4 revisions

All application communication has been implemented as a single standardized interface.

The Hub Object

The hub object provides a uniform and simple way for applications to communicate with each other. The hub implements the publish–subscribe pattern. Generally hubs are connected peer-to-peer. Using the hub.on() method, a function can be assigned to listen for a event of a certain type to be received. Upon receiving the event, the function will be executed by the hub with any data contained in the event. Event data is split into an array of a basic type (e.g. int, string). When an event needs to be sent by the application, the hub.emit() method can be called to create an event with a given type and data. To process any pending events, the hub.poll() method needs to be called. The hub will process a group of events, and then return.

Clone this wiki locally