30 lines
748 B
TypeScript
30 lines
748 B
TypeScript
/**
|
|
* Represents a Server-Sent Event.
|
|
*/
|
|
export interface SSEvent {
|
|
|
|
/**
|
|
* Event data.
|
|
*/
|
|
data: string;
|
|
|
|
/**
|
|
* Event type.
|
|
* This value is optionally sent by the server. Traditional EventSource allows listeners for specific event types.
|
|
* The SSE Session collapses all event types into "message" event.
|
|
*/
|
|
event?: string;
|
|
|
|
/**
|
|
* Event ID.
|
|
* This value is optionally sent by the server as a "checkpoint" the client can use to resume from using the Last-Event-ID header.
|
|
*/
|
|
id?: string;
|
|
|
|
/**
|
|
* Reconnection time in milliseconds.
|
|
* This value is optionally sent by the server to indicate the server's preferred time before reconnecting
|
|
*/
|
|
retry?: number;
|
|
}
|