Skip to content

Network & Web Services

The Network & Web Services module provides all connectivity and remote-access capabilities for the CNC pendant. It manages the WiFi radio (Station and Access Point modes), orchestrates dependent service lifecycle as network state changes, and exposes the embedded WebUI, file system access, real-time data streams, and device-discovery protocols over the local network.

Key responsibilities:

  • WiFi lifecycle management (STA / AP / off)
  • HTTP server with WebUI serving, file upload/download, and WebDAV
  • WebSocket server for real-time pendant data and remote commands
  • mDNS and SSDP for zero-configuration device discovery
  • Session authentication
  • Push notifications to external services
  • NTP time synchronization (STA mode only)

Product model constraint: WiFi serves either the remote (HTTP / WebUI / discovery) role or the CNC transport (TCP socket client) role — never both simultaneously. Bluetooth CNC and WiFi are also mutually exclusive. These constraints are enforced at build time by cmake/sanity_check.cmake.


Network & Web Services

Core Platform

Network Services

WiFi Modes

network ready

network ready

network ready

network ready

network ready

network ready

STA only

network ready

network ready

network ready

status_bar_label

ESP3DX

(app_main)

ESP3DSettings

(NVS)

ESP3DValues

(observable)

ESP3DNetwork

orchestrator

networkTask

FreeRTOS

ESP3DWifiClient

low-level WiFi

WiFi STA

wifi_sta_event_handler

WiFi AP

wifi_ap_event_handler

ESP3DHttpService

HTTP server

WebSocket server

ESP3DWsService

ESP3DWebUiService

WebUI over WS

ESP3DWsDataService

data streaming

ESP3DmDNS

ESP3Dssdp

ESP3DAuthentication

Service

ESP3DNotifications

Service

TimeService

NTP

ESP3DNetworkServicesESP3DWifiClientESP3DNetworkapp_main / ESP3DXESP3DNetworkServicesESP3DWifiClientESP3DNetworkapp_main / ESP3DXloop[networkTask monitoring]begin()read mode from NVSstart (STA or AP)CONNECTED eventbegin()HTTP server startWebSocket server startmDNS startSSDP startAuth service startNotifications startTimeService.begin() [STA only]DISCONNECTED eventend() - stop all servicesreconnectCONNECTED eventbegin() - restart services

request

check session

GET WebUI assets

GET/POST /files

GET/POST /sdfiles

PROPFIND / PUT / DELETE

HTTP Client

(browser / tool)

ESP3DHttpService

esp-idf httpd

ESP3DAuthentication

Service

ESP3DWebUiPsramCache

PSRAM-backed cache

Flash FS handler

esp3d_files.cpp

SD FS handler

esp3d_sdfiles.cpp

WebDAV handler

esp3d_webdav_propfind.cpp

ESP3DNotificationsService

EmailNotificationProvider

HomeAssistantProvider

IFTTTProvider

PushoverProvider

TelegramProvider

WhatsAppProvider


Features are selected via CMakeLists.txt OPTION() declarations, converted to defines in cmake/features.cmake, and validated in cmake/sanity_check.cmake.

FeatureCMake optionDefaultNotes
HTTP server + WebUIWEBUI_SERVERONDisabled when SOCKET_CLIENT_SERVICE ON
WebSocket serverWS_SERVER_SERVICEONDisabled when SOCKET_CLIENT_SERVICE ON
mDNSMDNS_SERVICEONRequires WiFi
SSDPSSDP_SERVICEONDisabled when SOCKET_CLIENT_SERVICE ON
WiFi CNC socket clientSOCKET_CLIENT_SERVICEOFFMutually exclusive with WebUI / SSDP / WS
NotificationsNOTIFICATION_SERVICE——
NTP timeESP3D_TIMESTAMP_FEATURE—STA mode only at runtime

Class / FilePathRole
ESP3DNetworkmain/modules/network/esp3d_network.hTop-level orchestrator — owns service lifecycle
ESP3DXNetwork / networkTaskmain/modules/network/esp3d_x_network.h/.cppFreeRTOS task wrapper for the network loop
ESP3DNetworkServicesmain/modules/network/esp3d_network_services.hStarts/stops all dependent services atomically
ESP3DWifiClient / ESP3DIpInfosmain/modules/wifi/esp3d_wifi_client.hLow-level WiFi driver; exposes IP info
ESP3DHttpServicemain/modules/http/esp3d_http_service.hesp-idf HTTP server; file and WebUI serving
PostUploadContextmain/modules/http/esp3d_http_service.hUpload state for multipart POST handlers
ESP3DWebUiPsramCachemain/modules/http/esp3d_webui_psram_cache.hPSRAM-backed asset cache for WebUI files
ESP3DWebSocketConfig / ESP3DWebSocketInfosmain/modules/websocket_server/esp3d_ws_service.hWebSocket server base (config + per-client state)
ESP3DWebUiServicemain/modules/websocket_server/esp3d_webui_service.hWebUI channel over WebSocket
ESP3DWsDataService / ESP3DWsTransferInfomain/modules/websocket_server/esp3d_ws_data_service.hReal-time pendant data streaming
ESP3DmDNSmain/modules/mdns/esp3d_mdns.hmDNS device advertisement
ESP3Dssdpmain/modules/ssdp/esp3d_ssdp.hSSDP / UPnP device discovery (wraps SSDP_IDF)
ESP3DAuthenticationServicemain/modules/authentication/esp3d_authentication.hSession-based auth for HTTP and WS
ESP3DAuthenticationRecordmain/modules/authentication/esp3d_authentication_records.hPer-session credential record
ESP3DNotificationsServicemain/modules/notifications/esp3d_notifications_service.hPush notification dispatch to external providers
TimeServicemain/modules/time/esp3d_time_service.hNTP sync (STA only) and manual settimeofday
  • Radio vs CNC link: the WiFi, network and network-services layers write connection_status / server_status only when the radio is the CNC link (ESP3DNetwork::radioIsCncLink()); [ESP109] lets the setup AP fallback rejoin the STA network. See network.md, wifi.md.
  • HTTP: mutex-protected WebUI PSRAM cache with invalidate(), WebDAV protocol hardening (411, same-path COPY / MOVE refused, no Content-Length with chunked responses). See http_service.md.
  • WebSocket / authentication: level checked on every line and binary frame, /ws bound to a valid HTTP session, broadcast data only to authorized sockets, [ESP510] HTTP / STREAM timeouts, [ESP500]LOGOUT. See websocket_server.md, authentication.md, esp3d_x_stream_authentication.md.
  • The native USB CDC device client (main/modules/usb_cdc_device/) is not a network service: it is documented with the transports in Communication_Transports.md.

  • docs/architecture/connection_management.md — connection lifecycle, status codes (U, T, C, ?, A)
  • docs/features/feature_resource_matrix.md — WiFi/CNC transport exclusivity table, resource budgets (§2–§4)
  • docs/features/mdns.md — mDNS registered services and _device-info._tcp TXT record reference
  • docs/architecture/websockets_protocol.md — WebSocket endpoints, V1 binary protocol, server guide
  • docs/guides/esp32_memory_constraints.md — heap fragmentation with serial CNC + WiFi remote (fragmentation playbook section)
  • docs/features/features.md — hardware / connectivity / services × SKU matrix; §9 backlog (HTTPS, WSS)