Real-time web features using cross-border messaging over the event bus

Tip
The corresponding source code is in the step-10 folder of the guide repository.

Earlier in this guide we saw the event bus in action for verticles to communicate using message-passing inside Vert.x applications. The developer only has to register a consumer to receive messages and sending / publishing messages.

The SockJS event bus bridge extends these capabilities to the client-side, in the web browser. It creates a distributed event bus which not only spans multiple Vert.x instances in a cluster, but also includes client-side JavaScript running in (many) browsers. We can therefore create a huge distributed event bus encompassing many browsers and servers, resulting in a consistent message-based programming model across all constituents of a distributed application.

In this chapter, we will modify the code from step-9 so that:

  • the Markdown content to be rendered is sent to the server without creating new HTTP requests, and

  • the page shows a warning when a user is editing a page which has just been modified by another user.