EventSource
EventSource copied to clipboard
Calling Disconnect doesnt close the connection
No response?
Is anyone solved this issue?
I had this issue intially, where disconnect wasn't actually ever disconnecting. After some debugging I realised that it was actually because my faulty code was creating a new instance of EventSource
on every message received. The newly created instances weren't ever properly connected, which mean their urlSession
variable was always nil
and therefore the disconnect urlSession?.invalidateAndCancel()
was never called. Fixing my code to ensure only one instance of EventSource
was created solved my issue.