Mediator is an approach to adding a third-party object to control the interaction between a group of (2 or more) objects.
The simplest example you can find is the Chat Room , where you can see that the ChatRoom object controls the interaction between 2 (or more) User Objects. In practice, if you see a web application, such as Facebook , it creates a web socket for each of the chat boxes that you open. Thus, the web socket interacts with the mediator (server) and the client. When group chat occurs, each client synchronizes with the server using dedicated web sockets.
source
share