2 * Example ESP32 app code using Libwebsockets
4 * Copyright (C) 2017 Andy Green <andy@warmcat.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation:
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * This is intended to be mounted somewhere in your ESP32 user app... if the
22 * client touched the mount, the plugin hangs up and reboots into the
23 * factory mode one second later.
25 * The factory mode will reassociate with the same IP with the same MAC
26 * shortly afterwards and be accessible by the same IP / mDNS name.
29 #include <esp_partition.h>
30 #include <esp_ota_ops.h>
34 callback_esplws_rtf(struct lws *wsi, enum lws_callback_reasons reason,
35 void *user, void *in, size_t len)
39 case LWS_CALLBACK_HTTP:
41 lws_esp32_restart_guided(LWS_MAGIC_REBOOT_TYPE_REQ_FACTORY);
51 #define LWS_PLUGIN_PROTOCOL_ESPLWS_RTF \
54 callback_esplws_rtf, \