Skip to main content

Module http_server

Module http_server 

Source
Expand description

Web UI and REST API server using picoserve.

ยงConfiguration

WEB_TASK_POOL_SIZE sets the number of concurrent web task. Greatly increased RAM usage with each task. TCP_BUFFER_SIZE sets the size of the TCP buffer for each connection. HTTP_BUFFER_SIZE sets the size of the HTTP buffer. This greatly impact the upload speed of assets and files.

ยงRouted Endpoints

RouteMethodBacking handler or asset
/get_store_itemsGETget_store_items
/install_widgetPOSTpost_install_widget
/wifi_modeGETget_wifi_mode
/wifi_credentialsPOSTpost_wifi_credentials
/system_configGETget_system_config
/system_configPOSTpost_system_config
/deinstall_widget/<widget_name>GETdeinstall_widget
/config_schema/<widget_name>GETget_config_schema
/widget_config/<widget_name>POSTpost_widget_config
/widget_configuration/<widget_name>GET[get_widget_config]
/GETfrontend::INDEX_HTML
/frontend.jsGETfrontend::FRONTEND_JS
/frontend_bg.wasmGETfrontend::FRONTEND_WASM_GZ
/output.cssGETfrontend::OUTPUT_CSS
/assets/logo.pngGETfrontend::LOGO_PNG
/assets/css/bootstrap.cssGETfrontend::BOOTSTRAP_CSS
/assets/js/jquery.min.jsGETfrontend::JQUERY_JS
/assets/js/underscore.jsGETfrontend::UNDERSCORE_JS
/assets/js/jsonform.jsGETfrontend::JSONFORM_JS
/assets/js/jsonform-defaults.jsGETfrontend::JSONFORM_DEFAULTS_JS
/assets/js/jsonform-split.jsGETfrontend::JSONFORM_SPLIT_JS
/assets/html/widget_config.htmlGETfrontend::WIDGET_CONFIG_HTML
/assets/fonts/glyphicons-halflings-regular.eotGETfrontend::FONT_GLYPHS_EOT
/assets/fonts/glyphicons-halflings-regular.svgGETfrontend::FONT_GLYPHS_SVG
/assets/fonts/glyphicons-halflings-regular.ttfGETfrontend::FONT_GLYPHS_TTF
/assets/fonts/glyphicons-halflings-regular.woffGETfrontend::FONT_GLYPHS_WOFF
/assets/fonts/glyphicons-halflings-regular.woff2GETfrontend::FONT_GLYPHS_WOFF2

Modulesยง

custom_types ๐Ÿ”’
Types used by http_server handlers to serve different types of content and errors
frontend ๐Ÿ”’
List of static frontend assets that are embedded into the compiled binary.

Structsยง

Application
WebApp

Constantsยง

ASSET_HEADER ๐Ÿ”’
Asset http headers
HTTP_BUFFER_SIZE ๐Ÿ”’
INDEX_CACHE_HEADER ๐Ÿ”’
TCP_BUFFER_SIZE ๐Ÿ”’
WEB_TASK_POOL_SIZE

Functionsยง

deinstall_widget ๐Ÿ”’
Remove widget from system config and storage
get_config_schema ๐Ÿ”’
gets the JSON config schema for a given widget
get_store_items ๐Ÿ”’
gets and returns all widget store items as JSON.
get_system_config ๐Ÿ”’
gets and returns the currently stored system config, create a new default config if none is present (first boot)
get_wifi_mode ๐Ÿ”’
gets the current wifi mode (AP or Station) to let the frontend decide which components to show
post_install_widget ๐Ÿ”’
Installs a widget from a given URL or from the widget store, determined by the InstallAction payload.
post_system_config ๐Ÿ”’
receives an updated system configuration from the frontend and saves it to NVS. The config is only saved if there are changes to avoid flash wear.
post_widget_config ๐Ÿ”’
update the JSON config for a given widget
post_wifi_credentials ๐Ÿ”’
receives wifi credentials from the frontend, saves them to storage and reboots
start
web_task