Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_network_sse.c File Reference
#include "nilorea/n_str.h"
#include "nilorea/n_log.h"
#include "nilorea/n_network.h"
#include <getopt.h>
#include <string.h>
+ Include dependency graph for ex_network_sse.c:

Go to the source code of this file.

Macros

#define MAX_EVENTS   3
 maximum number of events to receive before stopping
 

Functions

int main (int argc, char *argv[])
 
static void on_sse_event (N_SSE_EVENT *event, N_SSE_CONN *conn, void *user_data)
 SSE event callback.
 
void usage (void)
 

Variables

static int event_count = 0
 counter for received events
 
static N_SSE_CONNg_conn = NULL
 pointer to connection for callback to stop
 

Macro Definition Documentation

◆ MAX_EVENTS

#define MAX_EVENTS   3

maximum number of events to receive before stopping

Examples
ex_network_sse.c.

Definition at line 35 of file ex_network_sse.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 69 of file ex_network_sse.c.

References event_count, g_conn, getoptret, LOG_DEBUG, LOG_ERR, LOG_INFO, log_level, LOG_NOTICE, LOG_NULL, n_log, n_sse_conn_free(), n_sse_connect(), on_sse_event(), set_log_level(), and usage().

+ Here is the call graph for this function:

◆ on_sse_event()

static void on_sse_event ( N_SSE_EVENT event,
N_SSE_CONN conn,
void *  user_data 
)
static

SSE event callback.

Parameters
eventthe received SSE event
connthe SSE connection
user_dataunused
Examples
ex_network_sse.c.

Definition at line 53 of file ex_network_sse.c.

References N_SSE_EVENT::data, N_STR::data, N_SSE_EVENT::event, event_count, g_conn, N_SSE_EVENT::id, MAX_EVENTS, and n_sse_stop().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usage()

void usage ( void  )

Definition at line 42 of file ex_network_sse.c.

Variable Documentation

◆ event_count

int event_count = 0
static

counter for received events

Examples
ex_network_sse.c.

Definition at line 38 of file ex_network_sse.c.

Referenced by main(), and on_sse_event().

◆ g_conn

N_SSE_CONN* g_conn = NULL
static

pointer to connection for callback to stop

Examples
ex_network_sse.c.

Definition at line 40 of file ex_network_sse.c.

Referenced by main(), and on_sse_event().