stream_events


Description:

[ Version ( since = "0.3" ) ]
public HandlerCallback stream_events (owned EventStreamCallback context)

Middleware that create a context for sending Server-Sent Events.

The VSGI.Response cannot be manipulated directly, but through a Valum.ServerSentEvents.SendEventCallback callback instead.

The stream is explicitly flushed the ensure that the user agent receives the message.

Messages are send directly with the Soup.Encoding.EOF encoding as recommended by the W3C.

The middleware automatically send a keep-alive every 15 seconds to ensure that unaware clients keep the connection opened.

Parameters:

context

context for sending events


Package: valum-0.3