Referenced by the official spring-framework docs

Introduction

It’s important to understand that HTTP is used only for the initial handshake, which relies on a mechanism built into HTTP to request a protocol upgrade (or in this case a protocol switch) to which the server can respond with HTTP status 101 (switching protocols) if it agrees. Assuming the handshake succeeds the TCP socket underlying the HTTP upgrade request remains open and both client and server can use it to send messages to each other.

WebSocket Fallback Options

An important challenge to adoption is the lack of support for WebSocket in some browsers. Furthermore, some restrictive proxies may be configured in ways that either preclude the attempt to do an HTTP upgrade or otherwise break connection after some time because it has remained opened for too long. Therefore to build a WebSocket application today, fallback options are required in order to simulate the WebSocket API where necessary. …


Image for post
Image for post

1. Publish / Subscribe Messaging

Publish / Subscribe Messaging is a pattern that is characterized by the sender(publisher) of a piece of data(message) not specifically directing it to a receiver. Instead, the publisher classifies the message somehow, and that receiver(subscriber) subscribes to receive certain classes of messages. Pub/Sub systems often have a broker, a central point where messages are published, to facilitate this.

2. What is Kafka?

Apache Kafka is a publish/subscribe messaging system designed to have a single centralized system that allows for publishing generic types of data. It is often described as a distributed streaming system. Data within Kafka is stored durably, in order, and can be read deterministically. …


Image for post
Image for post

✓ Single Responsibility Principle

There should never be more than one reason for a class to change

  • focuses on a single functionality
  • addresses a specific concern

Example

  • Protocol Change: http -> https
  • Message Format Change: json -> xml
  • Communication Security Change: authentication

There is three separate responsibilities then we should have three separate classes of modules

Conclusion

Whenever you’re designing a class or module you should take care that class is addressing only a specific concern so that when a change is needed there is only one reason for a particular class to change.

✓ Open-Closed Principle

Software entities(classes, modules, methods etc.) …

About

Alex Won

Backend Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store