0

I have a structure where an application sends a POST request, the API handles the parameters and enters them into the database then another application that is supposed to run a function when the POST request was handled. The only issue I'm having is how can I make the 2nd application know when the request was handled other than running a GET request on a time interval?

Another explanation:

Client A: POSTs data

API: Handles data

Client B: GETs and displays data to user

How can I tell Client B when to do the GET request?

This is all in node.js and using express

QZAK
  • 63
  • 1
  • 6
  • 1
    You might be looking for the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). Client B would listen for events emitted by the API. – D M Jul 13 '22 at 17:09

1 Answers1

1

What you need is to push data to clients when something happens server-side. This can be achieved by either server side events (which do exactly this), or websockets which create a bidirectional communication channel between server and client. Which one to choose? Check out this stack overflow post.

ParadigmShift
  • 231
  • 2
  • 4