Web Server AT Commands

[中文]

Introduction

Important

The default AT firmware does not support the AT commands listed on this page. If you need ESP32-C6 to support web server commands, you can compile the ESP-AT project by following the steps in Compile ESP-AT Project Locally documentation. In the project configuration during the fifth step, make the following selections:

  • Enable Component config -> AT -> AT Web Server command support

AT+WEBSERVER: Enable/disable Wi-Fi connection configuration via Web server

Set Command

Command:

AT+WEBSERVER=<enable>,<server_port>,<connection_timeout>

Response:

OK

Parameters

  • <enable>: Enable or disable Web server.

    • 0: Disable the Web server and release related resources.

    • 1: Enable Web server, which means that you can use WeChat or a browser to configure Wi-Fi connection information.

  • <server_port>: The Web server port number.

  • <connection_timeout>: The timeout for the every connection. Unit: second. Range:[21,60].

Notes

  • There are two ways to provide the HTML files needed by the Web server. One is to use FAT file system, and you need to enable AT FS command at this time. The other one is to use embedded files to store HTML files (default setting).

  • Please make sure that the maximum number of open sockets is not less than 12, you may change the number by ./build.py menuconfig > Component config > LWIP > Max bumber of open sockets and compile the project (see Compile ESP-AT Project Locally).

  • The default firmware does not support Web server AT commands (see ESP-AT Firmware Differences), but you can enable it by ./build.py menuconfig > Component config > AT > AT WEB Server command support and compile the project (see Compile ESP-AT Project Locally).

  • ESP-AT supports captive portals in ESP32-C6 series of devices. See example.

  • For more examples, please refer to Web Server AT Example.

  • The command implementation is open-source. See the source code in at/src/at_web_server_cmd.c.

  • Please refer to How to Implement OTA Upgrade for more OTA commands.

Example

// Enable the Web server with port 80, and the timeout for the every connection is 50 seconds
AT+WEBSERVER=1,80,50

// Disable the Web server
AT+WEBSERVER=0