Skip to content

Core\Sse

An event stream from your server to a client, as a browser's EventSource reads it. A request calls startStream to answer with events, or upgrade to start a script that keeps sending after the request ends. Code that did not open the stream calls current to get it, and send writes one event.

Members

6 members.

MemberSignature
upgradeupgrade(string $entry, mixed $arguments = null, mixed $limits = null, ?array<string> $grants = null, ?string $on = null): void
startStreamstartStream(): Core\Sse
currentcurrent(): Core\Sse
receivereceive(): ?Core\Sse\Message
sendsend(mixed $data, ?string $event = null, ?string $id = null): void
setRetryDelaysetRetryDelay(Core\Time\Duration $after): void

Example apps

These complete apps use this class. You can download and run each one.

  • Poll: A live poll with SQLite and server-sent events. Every open page shows each new vote at once, with no extra server and no library.