You must define an event handler function with the signature int handler(sb_Event *e). Inside the handler, you check the event type (e.g., SB_EV_REQUEST) and use stream functions to respond to the client. The handler should return SB_RES_OK to indicate the event was handled successfully.
static int event_handler(sb_Event *e) {
if (e->type == SB_EV_REQUEST) {
sb_send_status(e->stream, 200, "OK");
sb_send_header(e->stream, "Content-Type", "text/plain");
sb_writef(e->stream, "Hello world");
}
return SB_RES_OK;
}