DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
DeterministicESPAsyncWebServer.h File Reference

Layer 7 (Application) — public HTTP routing API. More...

#include "network_drivers/presentation.h"
#include "network_drivers/session.h"
#include <Arduino.h>

Go to the source code of this file.

Classes

struct  Route
 Internal route entry stored in the routing table. More...
 
class  DetWebServer
 Single-port HTTP server with deterministic, zero-allocation execution. More...
 

Typedefs

typedef void(* Handler) (uint8_t slot_id, HttpReq *request)
 Callback signature for HTTP request handlers.
 

Enumerations

enum  HttpMethod {
  HTTP_GET , HTTP_POST , HTTP_PUT , HTTP_DELETE ,
  HTTP_PATCH , HTTP_HEAD , HTTP_OPTIONS
}
 HTTP request methods supported by the router. More...
 
enum  RouteType { ROUTE_HTTP }
 Discriminates between HTTP, WebSocket, and SSE route entries. More...
 

Detailed Description

Layer 7 (Application) — public HTTP routing API.

This is the only header most application code needs to include. The full OSI include chain is pulled in automatically:

DeterministicESPAsyncWebServer.h
└── network_drivers/presentation.h (Layer 6)
├── network_drivers/transport.h (Layer 4)
│ └── DetWebServerConfig.h (compile-time constants + feature flags)
└── network_drivers/http_parser.h (parser types)
└── network_drivers/session.h (Layer 5 — event queue)

Feature flags — define any of these to 0 before including to strip the feature from the build entirely:

#define DETWS_ENABLE_WEBSOCKET 0
#define DETWS_ENABLE_SSE 0
#define DETWS_ENABLE_MULTIPART 0
#define DETWS_ENABLE_FILE_SERVING 0
#define DETWS_ENABLE_AUTH 0
Layer 7 (Application) — public HTTP routing API.

Determinism guarantees

  • All buffers are statically allocated; no heap usage after begin().
  • Every operation has O(1) or O(MAX_ROUTES) worst-case time.
  • handle() is safe to call every Arduino loop() iteration.
Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file DeterministicESPAsyncWebServer.h.

Typedef Documentation

◆ Handler

typedef void(* Handler) (uint8_t slot_id, HttpReq *request)

Callback signature for HTTP request handlers.

The callback receives the connection slot index and a pointer to the fully-parsed request. Call DetWebServer::send() or DetWebServer::send_empty() from inside the callback to write a response.

Parameters
slot_idIndex into the connection pool (0 … MAX_CONNS-1).
requestPointer to the parsed HTTP request. Valid only during the callback; do not cache this pointer.
Note
If the callback returns without calling send(), the framework will reset the slot automatically (no response is sent to the client).

Definition at line 103 of file DeterministicESPAsyncWebServer.h.

Enumeration Type Documentation

◆ HttpMethod

enum HttpMethod

HTTP request methods supported by the router.

Pass one of these values to DetWebServer::on() to bind a route to a specific method. PATCH, HEAD, and OPTIONS were added in v1.0 alongside CORS preflight support.

Enumerator
HTTP_GET 

Safe, idempotent read.

HTTP_POST 

Non-idempotent create / action.

HTTP_PUT 

Idempotent replace.

HTTP_DELETE 

Idempotent delete.

HTTP_PATCH 

Partial update.

HTTP_HEAD 

Same as GET but no response body.

HTTP_OPTIONS 

Capability query / CORS preflight.

Definition at line 74 of file DeterministicESPAsyncWebServer.h.

◆ RouteType

enum RouteType

Discriminates between HTTP, WebSocket, and SSE route entries.

Enumerator
ROUTE_HTTP 

Standard HTTP request/response.

Definition at line 147 of file DeterministicESPAsyncWebServer.h.