Sse event parser
This commit is contained in:
29
source/sse-session/types.ts
Normal file
29
source/sse-session/types.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user