Handle events emitted by SSE
mainThe SSE class implements the EventTarget interface and emits fully constructed Event objects. The event type corresponds to the Server-Sent Event's name.
Each event object contains the following fields:
id: The event ID, ornullif not present.lastEventId: The last seen event ID, or an empty string if no event with an ID was received.data: The unparsed event data.
Standard lifecycle events include:
open: Fired when the first block of data is received.error: Fired if an error occurs during the request.abort: Fired when the stream is explicitly aborted by the client.readystatechange: Fired when the ready state of the event source changes.