https://github.com/robinhosz/sse-with-springboot
This repository contains an example implementation of Server-Sent Events (SSE) using the Spring Boot framework.
https://github.com/robinhosz/sse-with-springboot
junit5 reactor-test reactor-tools real-time-events server-sent-events spring-boot sse webflux
Last synced: 6 months ago
JSON representation
This repository contains an example implementation of Server-Sent Events (SSE) using the Spring Boot framework.
- Host: GitHub
- URL: https://github.com/robinhosz/sse-with-springboot
- Owner: robinhosz
- License: mit
- Created: 2024-05-13T19:15:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-05-13T19:25:50.000Z (over 1 year ago)
- Last Synced: 2025-02-02T07:13:33.271Z (8 months ago)
- Topics: junit5, reactor-test, reactor-tools, real-time-events, server-sent-events, spring-boot, sse, webflux
- Language: Java
- Homepage:
- Size: 67.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SSE with Spring Boot
[](https://github.com/robinhosz/SSE-With-SpringBoot/blob/master/LICENSE)
π This repository contains an example implementation of Server-Sent Events (SSE) using the Spring Boot framework. SSE is a technology that enables a server to push asynchronous updates to a web client over a single, long-lived HTTP connection.
## Contents
1. π₯οΈ **src/main/java/github/io/robinhosz/sse/controller/SSEController.java:** This file contains the controller responsible for providing a continuous stream of SSE events to clients.
2. π οΈ **src/main/java/github/io/robinhosz/sse/service/SensorSimulatorService.java:** Here lies the service that simulates sensor data generation at regular intervals.
3. π **src/main/java/github/io/robinhosz/sse/model/SensorData.java:** This file defines the structure of sensor data.
4. β **src/test/java/github/io/robinhosz/sse/controller/SSEControllerTest.java:** Contains unit tests for the SSE controller.
5. β **src/test/java/github/io/robinhosz/sse/service/SensorSimulatorServiceTest.java:** Includes unit tests for the sensor data simulation service.## How to Run
1. π οΈ Make sure you have Java JDK and Maven installed on your system.
2. π₯ Clone this repository to your local machine.```bash
git clone https://github.com/robinhosz/SSE-With-SpringBoot.git
```
3. βοΈ Navigate to the cloned directory and run the application using Maven:```bash
cd sse-spring-boot
mvn spring-boot:run
```
4. π The server will start and be available at http://localhost:8080.
5. πOpen a web browser and access http://localhost:8080/events to see SSE events being continuously streamed.## Note:
This is a basic example and can be expanded to meet more complex SSE application requirements.## Contribute
* π€ Feel free to submit pull requests with enhancements.
* π Report issues or suggest new features using the Issues tab.