Open mlesswing opened 5 years ago
Hmm, in all honesty, I kinda lost track of this package. If you can propose an implemented solution to your problem, I'd be very happy to read and accept it. I'd also be happy to accept fellow maintainers.
Looking forward to a PR for this. Nice work, @rvowles !
I use parts of this lib in a private experimental project and found a possible cause for this issue: The EventSourceDecoder doesn't forward the error-events from the original stream to the controller (i.e. a onError: controller.addError
is missing). So the client is actually closed correctly, but this error is not handled and leads to a crash. However, I'm not sure how the downstream code (i.e. EventSource) would handle this error.
Since I don't consume the lib directly I don't plan to do a PR. But I wanted to left this as a note for anyone who is interested in fixing it. Took me quite some time to realize what led to the crash and the misleading error message.
I receive an exception when trying to close an EventSource from the client side.
import 'package:eventsource/eventsource.dart'; ... EventSource sseClient; ... sseClient = await EventSource.connect( ]);
...
sseClient.client.close();
Note: I could not find a close() method on EventSource shown in the non-normative developer note of https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events.