I am searching for a solution that allows me to make an Angular component listening to a backend object which get updated by some other service.
Actually, I have a component called SignatureStatusComponent
which shows the actual status of customer signature.
This signatureStatus
within Project
object is only updated in the backend via a REST exposed endpoint to a third-party service which allows users to perform their digital signatures.
My problem is how to update in real-time the UI with the actual status once the third-party service perform the callback to change the status.
Here is a simple schema to explain more the architecture :
For your information, I'm using SpringBoot
for backend and Angular
for frontend.
As I understand your question, you want to the Angular application to be notified, when something specific happens in the back-end (Spring Boot) app.
There are several possibilities, including polling, but in my opinion, the most straightforward thing would be to use Web Sockets.
On the Angular side, you can use the rxjs webSocket, which gives you an Observable that you can subscribe to for inbound messages (IIRC, you can call next() on it to send messages).
On the back-end, take a look at the TextWebSocketHandler or one of the SocketHandler classes.
The other option, if you have more complex requirements, is to use the STOMP protocol both ends - there are plenty of STOMP tutorials for Spring hanging around, and it looks like there's a STOMP implementation of the rxjs WebSocket