KEEL 1.0.0
Minimal C11 HTTP client/server library built on epoll/kqueue/io_uring/poll
Loading...
Searching...
No Matches
sse.h
Go to the documentation of this file.
1#ifndef KEEL_SSE_H
2#define KEEL_SSE_H
3
4#include <keel/response.h>
5#include <stddef.h>
6
13typedef struct {
15 void *write_ctx;
17} KlSse;
18
30
45int kl_sse_event(KlSse *sse, const char *event,
46 const char *data, size_t data_len, const char *id);
47
59int kl_sse_comment(KlSse *sse, const char *text, size_t len);
60
69int kl_sse_end(KlSse *sse);
70
71#endif
int(* KlWriteFn)(void *ctx, const char *data, size_t len)
Pluggable write callback — same signature as sh_json's ShJsonWriteFn.
Definition response.h:12
int kl_sse_begin(KlResponse *res, KlSse *sse)
Begin an SSE stream.
int kl_sse_end(KlSse *sse)
End the SSE stream.
int kl_sse_event(KlSse *sse, const char *event, const char *data, size_t data_len, const char *id)
Send an SSE event.
int kl_sse_comment(KlSse *sse, const char *text, size_t len)
Send an SSE comment (keep-alive ping pattern).
Definition response.h:21
SSE (Server-Sent Events) stream handle.
Definition sse.h:13
KlWriteFn write_fn
Definition sse.h:14
KlResponse * res
Definition sse.h:16
void * write_ctx
Definition sse.h:15