Skip to content

cf_client_web_wire

Category: net
GitHub: cute_networking.h


On web builds, wires a client to a datagram relay by URL -- the browser's road to a UDP server.

CF_Result cf_client_web_wire(CF_Client* client, const char* url);
Parameters Description
url The relay endpoint, e.g. "https://mygame.example/wire/5601". WebTransport is tried
at this URL first; on failure the same URL is retried as a WebSocket (https ->
wss). Both carry one datagram per message.

Return Value

Returns an error on native builds (this is web machinery), or when the URL is malformed.

Remarks

Call after cf_make_client and before cf_client_connect, in place of cf_client_set_wire. The connection opens in the background; packets sent before it opens are dropped, which the protocol's redundant handshake absorbs. The relay is an untrusted dumb pipe (every datagram is already encrypted), typically a tiny daemon on the game server's host that forwards WebTransport/WebSocket messages to the server's UDP port 1:1. See the Web topic page for the full picture, including a reference relay.

CF_ClientWire
cf_client_set_wire
cf_client_connect