Description
netty-websocket-spring-boot-starter is a Spring Boot starter for building WebSocket servers on Netty. It uses annotations similar to Spring's own WebSocket support. You write an endpoint class with the server endpoint annotation, and methods annotated with @OnOpen, @OnMessage, @OnClose, @OnError and @BeforeHandshake receive the events, along with injected values such as the session and HTTP headers. Endpoints in your application's package or a subpackage are registered automatically, with no extra component or manual exporter registration. Endpoints in other packages can be picked up with an @EnableWebSocket annotation that names the packages to scan. The WebSocket server runs on its own Netty listener, so the Spring server.port setting does not control it. It defaults to port 8081 and can be changed with the ws.port property. The project requires JDK 17 or later and targets Spring Boot 4 with Spring Framework 7. Spring Boot 3 users are directed to the 0.13.x line. The starter defaults to Netty 4.2.18.Final. The README covers a quick start, the annotation reference and configuration. It is aimed at Java developers who need a high-performance WebSocket endpoint in a Spring Boot application.…
Highlights
- Annotation-based WebSocket endpoints, similar to Spring WebSocket
- Own Netty listener, on port 8081 by default
- Lifecycle hooks for handshake, open, message, close and error
- Requires JDK 17 or later, targets Spring Boot 4
- Endpoint scanning outside the main package with @EnableWebSocket
Ratings & Reviews
No ratings yet
Be the first to rate Netty Websocket Spring Boot Starter.
People also visit

websocket-engineer
Building real-time communication systems with WebSockets or Socket.IO
Netty Websocket Spring Boot Starter FAQ
What does the starter do?
It lets you write WebSocket server endpoints in a Spring Boot application, using Netty as the transport and annotations for the event handlers.
Which Java and Spring versions are supported?
JDK 17 or later, with CI covering 17 and 21. The tested baseline is Spring Boot 4.1.1. Spring Boot 3 users should stay on version 0.13.x.
Why doesn't server.port change the WebSocket port?
The WebSocket server uses its own Netty listener. It defaults to 8081, and you change it with ws.port. The annotation's default of 80 is kept for compatibility.
How do I add endpoints in another package?
Add @EnableWebSocket(scanBasePackages = ...) to a configuration class and name the package that holds your endpoints.
Which events can I handle?
BeforeHandshake, OnOpen, OnMessage, OnClose and OnError. Each method can receive the session, HTTP headers or the throwable, depending on the event.
Can I add it to an existing web application?
Yes. The README says existing web applications can use it and that no extra component or manual exporter registration is needed.
Which Netty version does it use?
It defaults to Netty 4.2.18.Final. Boot's managed 4.2.17.Final is also tested. Validate other combinations before use.
What are the best Netty Websocket Spring Boot Starter alternatives?
Popular alternatives to Netty Websocket Spring Boot Starter include ChatApplication, RPC Websockets and SAEA. See all Netty Websocket Spring Boot Starter alternatives




