Use reusable HTTP, WebSocket, retry, rate-limit, and network-window helpers in Godot 4.
This addon gives you low-level transport building blocks so your game code can own authentication, sessions, matchmaking, and reconnect policy.
gdam install @aviorstudio/gd-network
Copy addon/ into res://addons/@aviorstudio_gd-network/ and enable the plugin.
const HttpClientModule = preload("res://addons/@aviorstudio_gd-network/src/http_client_module.gd")
var http := HttpClientModule.new()
http.setup(self)
http.get_json("https://example.com/api/profile", func(result: Dictionary) -> void:
if result.success:
print(result.json)
else:
push_warning(result.error_message)
)const RetryBackoffModule = preload("res://addons/@aviorstudio_gd-network/src/retry_backoff_module.gd")
var state := RetryBackoffModule.RetryState.new()
var config := RetryBackoffModule.RetryConfig.new(250, 2.0, 5, 5000)
state = RetryBackoffModule.next_retry(Time.get_ticks_msec(), state, config)HttpClientModule: callback-based JSON HTTP client for native and web exports.HttpPoolModule: acquire and release pooledHTTPRequestnodes.RetryBackoffModule: deterministic retry scheduling.RateLimitModule: token-bucket request limiting.NetworkWindowingModule: append, read, and prune ordered delta buffers.ErrorCatalogModule: shared network error keys and metadata.WebSocketClientModule: minimal reconnecting WebSocket node.WebFetchBridgeModule: web-only JavaScript fetch bridge used by HTTP helpers.
HTTP callbacks receive a dictionary with:
success: boolrequest_id: Stringstatus_code: intjson: Varianterror_key: Stringerror_message: Stringerror_code: String: validated domain code from a structured HTTP error.server_request_id: String: validated server correlation, separate from the localrequest_idhandle.
HTTP failure bodies use {error:{code,message,request_id}}. These fields populate bounded error text, validated domain codes and server correlation. Other bodies keep the status-derived error mapping.
HttpClientConfig defaults to eight concurrent requests per client. A ninth
request is rejected immediately with capacity_exceeded; a busy request is
never canceled or reused. Request bodies are limited to 1 MiB, response bodies
to 8 MiB, and retained error text to 1 KiB. Absolute HTTP
and HTTPS URLs are supported; relative endpoints require an HTTP(S) base_url.
Every accepted request has a generation identity. Capacity, validation,
explicit cancellation, timeout, transport failure, and completion invoke the
request callback exactly once with a typed error_key. cleanup() and owner
destruction invalidate pending callbacks without invoking consumer code.
Browser requests use a per-client namespace and one AbortController per
request; native requests disconnect stale completion signals before reuse.
HttpClientModule.post_zero_body(endpoint, callback, headers) sends a POST with exactly zero body bytes. post_json({}) still serializes and sends {}. Put authorization in headers; it is not a body field. Headers, timeout, and error callbacks are the same as post_json.
Native POST sets Content-Length: 0 only on the Godot HTTPRequest path. Web POST omits the fetch body and does not set Content-Length, which browsers forbid.
Both native HTTPRequest and browser fetch reject redirects with redirect_error. A redirect never triggers a second request, so Authorization is never forwarded to another target.
WebSocketClientModule uses 1 MiB inbound/outbound buffers, at most 64 queued
packets, and rejects outbound UTF-8 text larger than 1 MiB.
- No project settings are required.
- Native HTTP uses Godot
HTTPRequestnodes. - Web HTTP uses
JavaScriptBridgethroughWebFetchBridgeModule. - WebSocket support follows Godot
WebSocketPeerplatform behavior.
See LICENSE.
Install mise and GNU Make, then run:
mise run setup
mise run build
mise run testmise.toml pins SDK versions. cookbook.toml declares the addon package and its real tests; the canonical generated Mise task block uses an exact Cookbook revision from nicodes/cookbook. Setup installs the pinned editor, export templates and applicable dependencies. Build creates and verifies the closed addon archive; tests run source checks, native assertions, security checks and the declared packaged integration or browser checks. Packaged tests require the current verified build. Test commands do not run setup or rebuild the addon.
mise run help lists the available commands. Use mise run test:lint, mise run test:unit, mise run test:integration or mise run test:security for an individual group, mise run fmt for formatting, and mise run clean for declared generated files. Build and test evidence stays in .artifacts/verification.
mise run test:e2e runs the browser acceptance gate using the caller-local, locked Playwright SDK and pinned Chromium installed by mise run setup.