BEAM nodes

We must connect our BEAM nodes when deploying a real-time application to production. We covered in previous sections that a WebSocket- based application broadcasts outbound messages to all nodes in the cluster, using PubSub so that connections on other nodes receive the message for connections they own. If our nodes can not communicate, some messages will be missed and not sent to clients.

There are two ways to implement clustering in our application. The first way OTP comes out of the box is to connect nodes with distributed Erlang. This creates a direct peer-to-peer connection between all nodes in the cluster. However, some deployment environments may not network nodes this way due to connectivity restrictions. In these cases, it’s possible to use Redis as an alternative to clustering.

Get hands-on with 1400+ tech skills courses.