esp-idf/examples/protocols/https_server/wss_server
2021-09-09 17:16:48 +08:00
..
main esp_http_server: Fix examples parse ws keep-alive packet fail. 2021-03-16 09:55:02 +05:30
CMakeLists.txt https_server example: Add new WSS server example 2020-09-09 08:00:38 +02:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
README.md http_server: Fix docs for ws server user implementation 2021-09-09 17:16:48 +08:00
sdkconfig.defaults https_server example: Add new WSS server example 2020-09-09 08:00:38 +02:00
wss_server_example_test.py Split example_tests with Example_WIFI tag group into Example_OTA and Example_Protocols 2021-04-15 04:00:06 +00:00

HTTP Websocket server with SSL support

This example creates a SSL server and employs a simple Websocket request handler. It demonstrates handling multiple clients from the server including:

  • PING-PONG mechanism
  • Sending asynchronous messages to all clients

See the esp_https_server component documentation for details.

Before using the example, open the project configuration menu (idf.py menuconfig) to configure Wi-Fi or Ethernet. See "Establishing Wi-Fi or Ethernet Connection" section in examples/protocols/README.md for more details.

Websocket support in http_server

Please refer to the documentation of Websocket server feature in the documentation, or to the description of using websocket handlers in httpd in the simple ws echo example.

Certificates

You will need to approve a security exception in your browser. This is because of a self signed certificate; this will be always the case, unless you preload the CA root into your browser/system as trusted.

You can generate a new certificate using the OpenSSL command line tool:

openssl req -newkey rsa:2048 -nodes -keyout prvtkey.pem -x509 -days 3650 -out cacert.pem -subj "/CN=ESP32 HTTPS server example"

Expiry time and metadata fields can be adjusted in the invocation.

Please see the openssl man pages (man openssl-req) for more details.

It is strongly recommended to not reuse the example certificate in your application; it is included only for demonstration.