Orca
A bot framework that is easy to reason about, easy to debug, and easy to use.
Public Attributes | List of all members
ws_callbacks Struct Reference

Public Attributes

void(* on_connect )(void *data, const char *protocols)
 Called upon connection. More...
 
void(* on_text )(void *data, const char *text, size_t len)
 Reports UTF-8 text messages. More...
 
void(* on_binary )(void *data, const void *mem, size_t len)
 reports binary data.
 
void(* on_ping )(void *data, const char *reason, size_t len)
 reports PING. More...
 
void(* on_pong )(void *data, const char *reason, size_t len)
 reports PONG.
 
void(* on_close )(void *data, enum ws_close_reason wscode, const char *reason, size_t len)
 reports server closed the connection with the given reason. More...
 
void * data
 user arbitrary data to be passed around callbacks
 

Member Data Documentation

◆ on_close

void(* ws_callbacks::on_close) (void *data, enum ws_close_reason wscode, const char *reason, size_t len)

reports server closed the connection with the given reason.

Clients should not transmit any more data after the server is closed

◆ on_connect

void(* ws_callbacks::on_connect) (void *data, const char *protocols)

Called upon connection.

Note
It is not validated if matches the proposed protocols.

◆ on_ping

void(* ws_callbacks::on_ping) (void *data, const char *reason, size_t len)

reports PING.

Note
if provided you should reply with ws_pong(). If not provided, pong is sent with the same message payload.

◆ on_text

void(* ws_callbacks::on_text) (void *data, const char *text, size_t len)

Reports UTF-8 text messages.

Note
it's guaranteed to be NULL (\0) terminated, but the UTF-8 is not validated. If it's invalid, consider closing the connection with WS_CLOSE_REASON_INCONSISTENT_DATA.

The documentation for this struct was generated from the following file: