user10224243
user10224243

Reputation:

Java,Spring,Push Notification

I want to implement push notification in java so please help me out

1-Each time a new record(Message) pushed into data base(due to event created by some other user), a push notification should be sent to specific Logged in user automatically.

2-Content of the push notification should be the message present in the db.

3-If there are multiple messages, then the user should receive them one by one in a queue fashion.

4-Most important thing is the logged in user need not have to trigger any event to get notification, user should receive it automatically throughout the session.

Upvotes: 0

Views: 425

Answers (1)

Sheldor
Sheldor

Reputation: 310

You could use Server Sent Events. Java provides SseEmitter to send timely notifications. You can use EventSource API in JavaScript to trigger the SSE event stream and in the server-side, loop the database query code which is wrapped by an ExecutorService - which can spin of separate thread based on the initialization. Put SSE timeout to -1 for listening for an infinite amount of time.

Please note this answer is only a hint. Use these to explore more from the internet.

Upvotes: 1

Related Questions