mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'docs/update_ws_server_example_readme_v4.4' into 'release/v4.4'
docs: Add user-friendly guide about how to use ws_server_example_test.py (backport v4.4) See merge request espressif/esp-idf!16782
This commit is contained in:
@ -6,7 +6,8 @@ This example demonstrates the HTTPD server using the WebSocket feature.
|
|||||||
## How to Use Example
|
## How to Use Example
|
||||||
|
|
||||||
The example starts a websocket server on a local network. You need a websocket client to interact with the server (an example test
|
The example starts a websocket server on a local network. You need a websocket client to interact with the server (an example test
|
||||||
ws_server_example_test.py could be used as the simple websocket client).
|
ws_server_example_test.py could be used as the simple websocket client). If you run ws_server_example_test.py and get
|
||||||
|
`ModuleNotFoundError: No module named 'websocket'`, then please install `websocket` by running `python -m pip install websocket-client`.
|
||||||
|
|
||||||
The server registers websocket handler which echoes back the received WebSocket frame. It also demonstrates
|
The server registers websocket handler which echoes back the received WebSocket frame. It also demonstrates
|
||||||
use of asynchronous send, which is triggered on reception of a certain message.
|
use of asynchronous send, which is triggered on reception of a certain message.
|
||||||
|
@ -1,18 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
from __future__ import division, print_function, unicode_literals
|
from __future__ import division, print_function, unicode_literals
|
||||||
|
|
||||||
@ -20,9 +9,14 @@ import os
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import ttfw_idf
|
import ttfw_idf
|
||||||
import websocket
|
|
||||||
from tiny_test_fw import Utility
|
from tiny_test_fw import Utility
|
||||||
|
|
||||||
|
try:
|
||||||
|
import websocket
|
||||||
|
except ImportError:
|
||||||
|
print("Please install 'websocket' by running 'python -m pip install websocket-client'")
|
||||||
|
raise
|
||||||
|
|
||||||
OPCODE_TEXT = 0x1
|
OPCODE_TEXT = 0x1
|
||||||
OPCODE_BIN = 0x2
|
OPCODE_BIN = 0x2
|
||||||
OPCODE_PING = 0x9
|
OPCODE_PING = 0x9
|
||||||
|
@ -2846,7 +2846,6 @@ examples/protocols/http_server/restful_server/main/rest_server.c
|
|||||||
examples/protocols/http_server/simple/http_server_simple_test.py
|
examples/protocols/http_server/simple/http_server_simple_test.py
|
||||||
examples/protocols/http_server/simple/main/main.c
|
examples/protocols/http_server/simple/main/main.c
|
||||||
examples/protocols/http_server/ws_echo_server/main/ws_echo_server.c
|
examples/protocols/http_server/ws_echo_server/main/ws_echo_server.c
|
||||||
examples/protocols/http_server/ws_echo_server/ws_server_example_test.py
|
|
||||||
examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c
|
examples/protocols/https_mbedtls/main/https_mbedtls_example_main.c
|
||||||
examples/protocols/https_request/example_test.py
|
examples/protocols/https_request/example_test.py
|
||||||
examples/protocols/https_request/main/https_request_example_main.c
|
examples/protocols/https_request/main/https_request_example_main.c
|
||||||
|
Reference in New Issue
Block a user