WebSocket is a thin and lightweight layer above TCP, suitable for embed messages. As communication protocol, WebSocket provided a bi-directional, full-duplex, and persistent connection between two machines. Once a WebSocket connection is established, the connection stays open until the connection is closed. Check here for the differences between normal HTTP connection and WebSocket.
WebSocket is very suitable for web applications where the client and server need to exchange messages at high frequency but with low latency. As example is trading application in financial industry, which is very time sensitive. Another type of applications including collaboration tools (like chat application) and games.
Spring Framework introducing spring-websocket
module since version 4, with comprehensive WebSocket support. This module is not only compatible with the Java WebSocket API standard, but also provides additional value-add. This is included a set of annotations and key abstractions from the Spring Integration project such as Message
, MessageChannel
, MessageHandler
, and many others.
Tutorials in this series:
Spring Boot + WebSocket Basic Example
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. In this post, we will learn to create a simple web application, that will broadcast message using plain WebSocket connection.Spring Boot + WebSocket With STOMP Tutorial
STOMP is a simple text-based protocol, designed for working with message-oriented middleware (MOM). In this article we will walk through on how to create WebSocket connection in Spring Boot using STOMP protocol.Create Spring Boot + WebSocket Application using STOMP and SockJS
SockJS is a browser JavaScript library that provides a WebSocket-like object, that provides best available fallback options whenever WebSocket connection fails or unavailable.Build a Chat Application Using Spring Boot and WebSocket
In this article we will build a simple chat application, using Spring Boot, WebSocket, STOMP and SockJS to send and receive messages to/from a single user.
Related series:
Getting Started With Spring Boot
Spring Boot is a project built on the top of the Spring framework. It provides a simpler and faster way to set up, configure, and run applications.