Streaming responses with SSE

In the previous chapters, you learned how to create a REST service that returns a complete response at once. Most REST services work like this because of the nature of the underlying HTTP protocol. In this chapter, you've learned how to optimize the execution of such a REST service if it has to wait for other services. However, even optimized services may become slow to respond, because they can't be faster than the slowest call to another service. When completing a response takes a while, the client has to wait until all the data is prepared and the response is finally sent. This may have a range of negative consequences, which we can avoid if we send the data as soon as it's available in a stream of messages. The most natural way to do it in a REST service is using SSE, which works over the same HTTP protocol.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.65