std1.0.0-beta-7 SafeC docs

std :: http::sse

Struct std::SseClient

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

struct SseClient {
    int fd;
    ?&heap TlsStream tls;
    int chunked;
    unsigned long chunk_left;
    int eof;
    struct SseParser parser;
    struct String raw;
}

Fields

§int fdsource

the TLS session for https://, else null

§int chunkedsource

the response used chunked transfer coding

§unsigned long chunk_leftsource
§int eofsource
§struct SseParser parsersource
§struct String rawsource

undecoded bytes when chunked

Methods

§static struct SseClient connect( const &char url, const ?&char last_event_id, int timeout_ms, ?&int ok, )source · definition

GETs 'url' (http:// or https://) with Accept: text/event-stream and checks for a 200 text/event-stream response. 'last_event_id' (or null) is sent as Last-Event-ID. *ok = 0 on any failure. connect_tls takes https:// settings ('cfg' null: TlsConfig::new()'s defaults).

§static struct SseClient connect_tls( const &char url, const ?&char last_event_id, const ?&TlsConfig cfg, int timeout_ms, ?&int ok, )source · definition
§int next(&SseEvent out)source · definition

Blocks for the next event: 1 with 'out' filled, 0 once the stream ended or failed.

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

= drop()