std1.0.0-beta-7 SafeC docs

std :: http::sse

Struct std::SseStream

#include <std/http/sse.h> source

struct SseStream {
    struct TcpStream s;
    int ok;
}

Fields

§int oksource

0 once a write failed (the client left)

Methods

§static struct SseStream start(&HttpConn conn, const ?&char extra_headers)source · definition

Writes "200 OK" with Content-Type: text/event-stream, Cache-Control: no-cache and 'extra_headers' (null or "Name: value" lines), and detaches the connection.

§int send(const &char data)source · definition

"data: ..." (one data: line per line of 'data') + blank line.

§int send_event(const ?&char event, const &char data, const ?&char id)source · definition

With an optional event name and id (null to omit).

§int comment(const &char text)source · definition

": text" — a comment, the usual keep-alive ping.

§int retry(int ms)source · definition

"retry: ms" — the client's reconnection delay.

§void drop()source · definition
§void close() consumesource · definition

= drop()