NAME
net.h - Bark asynchronous HTTPS and WebSocket client primitives.
SYNOPSIS
Classes
Main-thread network event callbacks dispatched by bark_net_poll().
Typedefs
Opaque network manager handle (shared cookie jar + event queue).
Opaque WebSocket connection handle.
Lifecycle states of a WebSocket connection.
Main-thread network event callbacks dispatched by bark_net_poll().
Per-request HTTP response callback dispatched on the main thread inside bark_net_poll().
Streaming download chunk callback; return non-zero to abort with BARK_ERR_CANCELED.
Cooperative cancellation probe polled during bark_http_download().
Enumerations
Lifecycle states of a WebSocket connection.
Functions
Create a network manager handle.
Pump network I/O and dispatch completed HTTP and WebSocket callbacks.
Destroy a network manager handle and close active connections.
Open a ws:// or wss:// WebSocket connection (with optional Cookie header).
Send a UTF-8 text frame over an open WebSocket.
Send a binary frame over an open WebSocket.
Query the current bark_ws_state_t of ws.
Initiate a graceful WebSocket close with code and optional reason.
Issue an asynchronous HTTP(S) GET; response is delivered to on_http_resp with req_id.
Issue an asynchronous HTTP(S) POST; response is delivered to on_http_resp with req_id.
Issue an asynchronous HTTP(S) GET with a dedicated per-request callback.
Issue an asynchronous HTTP(S) POST with a dedicated per-request callback.
Blocking, cancellable streaming HTTP(S) GET (intended for background worker threads).
Detailed Description
Bark asynchronous HTTPS and WebSocket client primitives.
Headless HTTP(S) client and multi-instance RFC 6455 WebSocket API.
All asynchronous callbacks fire exclusively on the main thread inside bark_net_poll(). Works identically on native hosts (libcurl/OpenSSL) and browser WASM (fetch/WebSocket).
Enumeration Type Documentation
enum bark_ws_state
Lifecycle states of a WebSocket connection.
Enumerator
- BARK_WS_CLOSED
- Socket is closed.
- BARK_WS_CONNECTING
- TLS/HTTP upgrade handshake in progress.
- BARK_WS_OPEN
- Connected and ready to send/receive frames.
- BARK_WS_CLOSING
- Close handshake in progress.
Function Documentation
int bark_http_download (const char * url, bark_http_chunk_fn on_chunk, bark_http_cancel_fn should_cancel, void * user, int follow_redirects, int * status_out)
Blocking, cancellable streaming HTTP(S) GET (intended for background worker threads). Ideal for large asset or model downloads. Returning non-zero from on_chunk or should_cancel aborts the transfer with BARK_ERR_CANCELED.
Author
Generated automatically by Doxygen for Bark from the source code.