package tiny_httpd

  1. Overview
  2. Docs

A server-side function to generate of Server-sent events.

See the w3c page and this blog post.

  • since 0.9
val set_headers : Headers.t -> unit

Set headers of the response. This is not mandatory but if used at all, it must be called before any call to send_event (once events are sent the response is already sent too).

val send_event : ?event:string -> ?id:string -> ?retry:string -> data:string -> unit -> unit

Send an event from the server. If data is a multiline string, it will be sent on separate "data:" lines.

val close : unit -> unit

Close connection.

  • since 0.11