Typed Server-Sent Events (SSE) for SvelteKit with first-class TypeScript support, strongly typed client–server communication, and a versioned control protocol.
This library provides a structured, production-ready abstraction over native Server-Sent Events (SSE) for SvelteKit applications.
It focuses on:
App.EventsSee:
All application events are defined once using:
declare global {
namespace App {
interface Events {
status: {
heartbeat: number;
};
}
}
}
This definition drives both:
emit() typingon() typingThis library implements a protocol-level control channel for SSE, known as:
SSE Magic Control Protocol (SMCP)
SMCP guarantees that critical control messages (such as server-requested close) remain decodable even if custom serializers/deserializers are used.
📄 Protocol specification: ➡️ {@page sse-magic-protocol}
Each module is fully documented using TSDoc.
Apache-2.0 © ProjectSource V.O.F.