Drop-in WebSocket notifications for Spring Boot.
Send to users, topics, or broadcast — with offline queueing, ACK-based delivery tracking, and zero
boilerplate.
One dependency, one annotation. Every component has a sensible default and can be swapped by
declaring your own @Bean.
Target individual users, topic subscribers, or broadcast to every connected client with a single method call.
Notifications for offline users are stored with configurable TTL and per-user capacity. Delivered automatically on reconnect.
Confirm delivery with client acknowledgments. Unacknowledged notifications are retried automatically with configurable intervals.
Built-in ping/pong mechanism detects stale connections and closes them gracefully to keep your session registry clean.
Every component follows the interface + implementation pattern. Swap session storage, queue, authentication, or any other component.
Every auto-configured bean backs off the moment you declare your own. Swap any component —
authentication, queue, delivery tracking — with a single @Component.
From API call to WebSocket delivery, with offline queueing and retry built in.
Add the dependency, wire the components, and start sending notifications.
One entry in your pom.xml.
The starter brings spring-boot-starter-websocket
and notiflow-core
transitively.
<dependency>
<groupId>pl.notiflow</groupId>
<artifactId>notiflow-spring-boot-starter</artifactId>
<version>1.1.2</version>
</dependency>
Add the annotation and you're done. A WebSocket endpoint is available at /notifications
with sensible defaults.
@SpringBootApplication
@EnableNotiflow
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
Inject NotificationService
and start sending to users, topics, or everyone.
Notification notification = Notification.builder()
.type("alert")
.title("New message")
.message("You have a new message")
.priority(Priority.HIGH)
.build();
// Send to a single user
notificationService.sendToUser("user-123", notification);
// Send to all subscribers of a topic
notificationService.sendToTopic("sports", notification);
// Broadcast to everyone
notificationService.broadcast(notification);
Standard WebSocket connection. Handle notifications and respond to pings.
NoOpAuthenticator
which accepts every connection without any token check. Before going to production, replace it with
a token-based authenticator — see Custom
Authenticator in the documentation.
const ws = new WebSocket('ws://localhost:8080/notifications?userId=user-123');
ws.onmessage = (event) => {
const envelope = JSON.parse(event.data);
switch (envelope.type) {
case 'NOTIFICATION':
case 'QUEUED':
console.log('Received:', envelope.payload);
// Send ACK to confirm receipt
ws.send(JSON.stringify({
type: 'ACK',
payload: { notificationId: envelope.payload.id }
}));
break;
case 'PING':
ws.send(JSON.stringify({ type: 'PONG' }));
break;
}
};
Get started with NotiFlow in minutes. Check out the full documentation for advanced configuration and customization.