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

Browser "web serial" terminal over WebSocket (DETWS_ENABLE_WEB_TERMINAL). More...

#include "dwserver.h"

Go to the source code of this file.

Typedefs

typedef void(* TermCommandCb) (const char *line, uint8_t client_id)
 

Detailed Description

Browser "web serial" terminal over WebSocket (DETWS_ENABLE_WEB_TERMINAL).

A zero-heap equivalent of the WebSerial-style remote serial monitor: it serves a self-contained terminal web page and a WebSocket endpoint on the same path. Device output is broadcast to every connected browser; each line a browser sends is delivered to a command callback. Rides the library's existing WebSocket layer (no extra connection state), so it is TLS-agnostic - the page auto-selects ws:// or wss:// from the page's own scheme.

void on_cmd(const char *line, uint8_t client) {
detws_web_terminal_printf("you said: %s\n", line);
}
void setup() {
// ... wifi + server.on(...) ...
detws_web_terminal_begin(server, "/terminal");
detws_web_terminal_on_command(on_cmd);
server.begin(80);
}
void loop() {
server.handle();
detws_web_terminal_printf("uptime %lu\n", millis()); // device -> browsers
}

No-op stubs when DETWS_ENABLE_WEB_TERMINAL is 0.

Definition in file web_terminal.h.

Typedef Documentation

◆ TermCommandCb

typedef void(* TermCommandCb) (const char *line, uint8_t client_id)

Definition at line 80 of file web_terminal.h.