4 ms·
Polling every second would be wasteful; you can just make an HTTP request and hold the connection open until it's finished. Or just pass an URL, and let the oth
by icebraining 8y ago
Polling every second would be wasteful; you can just make an HTTP request and hold the connection open until it's finished. Or just pass an URL, and let the other side call you.
(That's assuming HTTP, which btw is not the only protocol which can implement REST constraints)
- kh_hk 8y agoThen you are dealing with client timeouts or the fact that a lot of endpoints do not support url callbacks (for good reasons) or maybe clients that cannot be called back (for good reasons too). Cannot say much about REST constraints outside of HTTP so excuse my ignorance on that. But I think it was clear the parent was referring to HTTP, or most possibly, GET and POST HTTP calls returning JSON.
- icebraining 8y agoYou always have to deal with timeouts and other network issues, regardless of protocol. Rather than retry every second, you retry on timeout.
- kh_hk 8y agoAnd yet most HTTP APIs are going to give you a response with an status instead of holding it. I guess because it's much easier to implement and also assumes less on the consumer part. Then there was Comet and what resulted from that, websockets and server side events.