Search code examples
javascriptbrowsernotificationspollingalerts

Any way to consume POST requests via browser?


Say you've got an app that can send out POST requests every time an action happens. It allows subscriptions to add/drop quickly and effortlessly.

Say that site is Stackoverflow and it can send a you POST notification every time a new question is asked. Would there be any way to consume notifications like this in browser?

I imagine a case when you spend > 5 min on a page you start to get notifications if it's updated since your last page refresh. I understand how you could do this via long polling but I am wondering if there's any way to hook into these server-to-client POST requests (vs. repeated GET client-to-server requests) from a browser and let data be pushed to you instead.


Solution

  • For pushing you could take a look at HTML5 WebSocket API.