Networking Reference
In-Depth Information
Introduction to Sockets
After having a look at the basic structure of ZeroMQ in previous chapter, in this
chapter we will have a look at sockets with respect to the following points:
• The publish-subscribe pattern
• The pipeline pattern
The publish-subscribe pattern
First, let's introduce the second classic pattern, that is, the publish-subscribe pattern,
which is a one-way distribution pattern where the server sends messages to a set of
clients. It is a one-to-many model. The fundamental idea of this pattern is a publisher
sends a message and connected subscribers receive the message, whereas disconnected
subscribers just miss the message. A publisher is loosely coupled to the subscribers and
does not care if any subscribers exist. It is similar to how TV channels or radio stations
work. A TV channel always broadcasts TV shows and only the viewers who turn that
channel on receive the broadcast. If you miss the time, you miss your favorite show
(unless you have TiVo or something similar, but let's assume that our scenario happens
in a world where recordings have not been invented). The advantage of the publish-
subscribe pattern is that it provides a more dynamic network topology.
The publish-subscribe pattern can be summarized in the following four main points:
Publish : An event is published by the publisher
Notify : The subscriber is notified of a published event
Subscribe : A new subscription is issued by a subscriber
Unsubscribe : A subscriber removes its existing subscription
Search MirCeyron ::




Custom Search