Hacker News new | ask | show | jobs
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.
1 comments

Without knowing more than the details you've just provided, I would suggest giving the various options a second look and weighing the pros/cons.

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.

Hi, I agree with each of your points you mentioned. Still it's kind of curiosity within me which is making me think to achieve this goal as we have ample time and this indeed is a business need.

It would be very nice of you if you can share few other solution other than using Ably's API :(