Publish Subscribe pattern

Publish Subscribe pattern

Table of Contents

Nowadays, Web Applications are set to target maximum relevant users as they can. In order to do so, an Application must comprise of qualities such as fully functional features, easiness, reliability, and last but not least “Performance and Speed”.

Performance and speed are considered as most important because nowadays in this hasty world people need results of their actions in real-time. Suppose you are in a chat room chatting with your friends and you don’t get a reply from them in time even if you have fully working internet connection how would you feel? Definitely, you would not like that.

In order to counter real-time communication problems, the concept of publisher-subscribers is introduced in web applications to built reliable applications.
In the Publisher-subscriber pattern, there are three main components:

1) Publisher :

One who sends or publishes the messages, notification or any sort of information.

2) Subscriber:

The one who is supposed to receive information sent by publisher.

3) Event-bus:

That Handles the request between publishers and subscribers, and responsible for delivering of messages. The Event bus acts as an intermediary or black box that collects all the messages for publishers and forward to subscribers based on their interests.

Rails provide us Action Cable which is based on a pub-sub pattern.
Action Cable is a framework for working with web sockets. It allows real-time communication between server and client and it requires a constant connection between client and server.
In typical Http model. data is being exchanged between clients and the server. Each Time when client tries to communicate with the server, a new connection is required. Request data is wrapped in a large header which causes a delay in a request to be processed.

However, on the other hand, it is different in case of web sockets, Date is transferred between client and server based on a pre-established connection. it has less overhead as compared to HTTP model, which makes it faster to swap data.
Request header are transferred only one time at the start of the communication so the rest of the requests do not have to contain lengthy headers. Websockets are mostly categorized in two types of connections One of them is TCP and second is UDP, each of these have their own certain characteristics

Most of the applications do not require a real-time communication because with web sockets we have to response all the time, which can make things little complicated. However if you need a real-time communication in you application Action cable is a great option to consider.

Subscribe to our Newsletter.

Thank you! Your subscription has been added to our newsletter!
Oops! Something went wrong while submitting the form.

Related Blogs.

What is Material Design Lite and what are its advantages?What is Material Design Lite and what are its advantages?
MDL stands for "Material Design Lite". It is a free and open source library used for website's designing and its a look like material design.
SEO with Angular – Angular UniversalSEO with Angular – Angular Universal
SEO is an abbreviation of Search Engine Optimization. Here, you will learn how to do SEO with Angular for a web page.
Difference between Functional and Object Oriented ProgrammingDifference between Functional and Object Oriented Programming
These are two very popular programming paradigms in software development that developers design and program to. Read more to find out.
How to use Font Awesome for your website?How to use Font Awesome for your website?
Font Awesome helps adding scalable and beautiful icons on a web page. Let's teach you how to use awesome fonts for your site.
JQuery: The Write Less, Do MoreJQuery: The Write Less, Do More
jQuery is a (write less or do more) lightweight JS library that simplifies programming with JavaScript. Know more about the benefits of using jQuery in this blog.
Cross Browser Compatibility IssuesCross Browser Compatibility Issues
What is Cross Browser issue? They usually occur in various web applications. Learn to solve these cross browser compatibility issues in this blog post.
How To Add Flash Messages in AngularJS?How To Add Flash Messages in AngularJS?
Is something wrong with adding flash messages in AngularJS? Read this guide to get professional advice.
Angular 4 FORMS ConfusionAngular 4 FORMS Confusion
Many people are often stuck with the Angular 4 forms confusion. But no need to worry because this solution will work for you.
Dependencies issue when one signal is used with google maps (React native)Dependencies issue when one signal is used with google maps (React native)
Problem Statement: Google maps work fine when used alone but it get dependency issue when one signal is added to the project.
Setup Redis on AWSSetup Redis on AWS
This tutorial will help you in setting up redis on AWS. Follow these steps to configure the redis through Amazon Linux.
React Native Facebook Login?React Native Facebook Login?
This guide provides examples of using the Facebook Login Button and Login Manager components in your React Native applications.
Create an Angular modular pluginCreate an Angular modular plugin
How to develop a Modular Plug-in For angular 4? Learn to create an angular modular plugin here.


You have an idea? We handle all the rest

Drop us a line.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.


500 Grant Street, Downtown, Suite 2900,
Pittsburgh, PA 15219, USA

+1 (412) 475 9053

United Kingdom

Suite A12, 56 Wood Lane, London,
W12 7SB, UK

+1 (93) 606  7875


2 West Canal Bank Road, Lahore 54000,

+92 304 0154349

Project inquiries

it’s not about ideas
it’s about making ideas happen
Copyright 2022 - Phaedra Solutions.
All Rights Reserved