HTML5 EventSource Sending Multiple Requests
I'm trying to implement Server Sent Events using Spring SseEmitter as described in this Youtube video. I'm able to initiate the event stream and receive the data from the server se
Solution 1:
The problem here is that the server unexpectedly closes the connection, instead of doing its work while leaving it open. When this happnes, the client re-sends a request to open a connection and to start streaming Server Sent Events. The server then closes the connection again and again, leading to an infinate loop.
One way to make sure this is the case is to set the retry
field in order to increase the browser's waiting time (the default is about 2-3 seconds). Another way is to have a while (true) {}
on the server side, just after the request arrives.
Also take a look at this post about SSEs.
Post a Comment for "HTML5 EventSource Sending Multiple Requests"