ralscha / sse-eventbus

EventBus library for sending events from a Spring appliction to the web browser with SSE
Apache License 2.0
79 stars 26 forks source link

Spring bug causes controller to re-dispatch connections #2

Closed smithtonson closed 6 years ago

smithtonson commented 6 years ago

There's a race-condition in Spring prior to V4.3.13 that causes methods that return an SseEmitter to re-dispatch after the client disconnects. Upgrading the project to use Spring 4.3.13 should fix this provided that emitter.completeWithError() is not called.

I.e. in SseEventBus.java, lines 294 & 299 should be noop and commented out. (Since the emitter is already completed)

see SPR-16058 and this comment

ralscha commented 6 years ago

Line 294 is a workaround that I needed for Microsoft Edge. This simply closes the event source connection after each message.