C Wrapper for WebSocket++ (Client only)
This is being used to implement a fake websocket-sharp to get recent SSL/TLS into older Mono projects, but can also be used for other stuff.
wspp_new(const char* uri) -> wspp_ws*
- create new websocket for URI (ws:// or wss://)wspp_delete(wspp_ws*)
- close websocket and free memorywspp_poll(wspp_ws*) -> uint64_t
- poll network and dispatch events non-blocking, returns number of handled eventswspp_run(wspp_ws*) -> uint64_t
- poll network and dispatch events blocking, returns number of handled eventswspp_stopped(wspp_ws*) -> bool
- returns true if the io service was shut downwspp_connect(wspp_ws*) -> wspp_error
- connect to the uri. do this before poll/run. returns an error codewspp_close(uint16_t code, const char* reason)
- disconnect the websocket. still need to poll/run until disconnectedwspp_send_text(wspp_ws*, const char* text) -> wspp_error
- send a text frame. text is utf8wspp_send_binary(wspp_ws*, const void* data, uint64_t len) -> wspp_error
- send a binary framewspp_ping(wspp_ws*, const void* data, uint64_t len) -> wspp_error
- send a pingwspp_set_open_handler(wspp_ws*, OnOpenCallback)
- set the open callbackwspp_set_close_handler(wspp_ws*, OnCloseCallback)
- set the close callbackwspp_set_message_handler(wspp_ws*, OnMessageCallback)
- set the message callbackwspp_set_error_handler(wspp_ws*, OnErrorCallback)
- set the error callbackwspp_set_pong_handler(wspp_ws*, OnErrorCallback)
- set the pong callbackenum wspp_error
WSPP_OK
- successWSPP_INVALID_STATE
- a function was called on a bad context - i.e. send_* while not connectedWSPP_UNKNOWN
- unspecified or unknown error occured
OnOpenCallback
:void(void)
OnCloseCallback
:void(void)
- TODO: code, reasonOnMessageCallback
:void(const char* data, uint64_t len, uint32_t opCode)
OnPongCallback
:void(const char* data, uint64_t len)
- Actual build system - currently build.sh is used to get a DLL from github actions
- Better errors
- Submodule ASIO
- Testing