ServerSentEvent Unicode C Reference Documentation

ServerSentEvent

Represents a server-sent event (SSE) received from an HTTP text/event-stream.

Create/Dispose

HCkServerSentEventW CkServerSentEventW_Create(void);

Creates an instance of the HCkServerSentEventW object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkServerSentEventW_Dispose(HCkServerSentEventW handle);

Objects created by calling CkServerSentEventW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkServerSentEventW_Dispose.

Properties

void CkServerSentEventW_getData(HCkServerSentEventW cHandle, HCkString retval);

const wchar_t *CkServerSentEventW_data(HCkServerSentEventW cHandle);

Introduced in version 9.5.0.58

The data for the server-side event. (If the "data" field was empty, then this will be empty.)

void CkServerSentEventW_getEventName(HCkServerSentEventW cHandle, HCkString retval);

const wchar_t *CkServerSentEventW_eventName(HCkServerSentEventW cHandle);

Introduced in version 9.5.0.58

The name of the server-side event. (If the "event" field was not present, then this will be empty.)

void CkServerSentEventW_getLastEventId(HCkServerSentEventW cHandle, HCkString retval);

const wchar_t *CkServerSentEventW_lastEventId(HCkServerSentEventW cHandle);

Introduced in version 9.5.0.58

The content of the "id" field, if present.

int CkServerSentEventW_getRetry(HCkServerSentEventW cHandle);

Introduced in version 9.5.0.58

The integer value of the "retry" field, if present. Otherwise 0.

Methods

BOOL CkServerSentEventW_LoadEvent(HCkServerSentEventW cHandle, const wchar_t *eventText);

Introduced in version 9.5.0.58

Loads the multi-line event text into this object. For example, the eventText for a Firebase event might look like this:

event: put
data: {"path": "/c", "data": {"foo": true, "bar": false}}

Returns TRUE for success, FALSE for failure.

Firebase Receive Server-Sent Events (text/event-stream)