|
|
|
|
|
by ravirajx7
1457 days ago
|
|
Hi, Thank you for responding. Actually we have one external API which provides this detail as soon as the payment is done. But we wanted something wherein once the payment is done we can directly send back the details directly to the connected client using that incoming webhook response instead of making the client(browser) to call one another API/fetch state present in DB periodically. |
|
Websockets to me don't seem like the ideal approach here, since the communication is just from the server to the client (an update of a data payload once an event occurs in the backend system).
Websockets have quite a bit of technical complexity requiring significant architectural effort to ensure reliability of a service. Ably is a company that offers websockets as a service and has some good blog articles to start you out if you're sure about this path.
What I would recommend with the details provided so far is to either use SSE or long-polling. The "downsides" are often over-exaggerated, and there are lots of businesses that one would assume use websockets that really are just using SSEs because operationally and architecturally it is vastly simpler to reason about.
I can almost guarantee that the complexity of adding another API endpoint will be drastically less than standing up a reliable websocket infrastructure.