Constructor
new SseEmitter(timeoutopt)
Creates a new SSE emitter with an optional timeout.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeout |
number |
<optional> |
The timeout in milliseconds after which the connection will be closed. |
Classes
Members
timeout :number|undefined
The timeout in milliseconds after which the connection will be closed or undefined if no timeout is set.
Type:
- number | undefined
Methods
extendResponse(outputMessage)
Sets and extends the response object for sending Server-Sent Events.
Parameters:
Name | Type | Description |
---|---|---|
outputMessage |
http.ServerResponse | The response object to use. |
send(event)
Sends a SSE event.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
object | The event to send. Properties
|
simulateTimeout()
Simulates a timeout.