forked from espressif/esp-idf
Merge branch 'docs/update_ws_server_example_readme_v4.3' into 'release/v4.3'
docs: Add user-friendly guide about how to use ws_server_example_test.py (backport v4.3) See merge request espressif/esp-idf!16784
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 WS server on a local network, so a WS client is needed to interact with the server (an example test
|
The example starts a WS server on a local network, so a WS client is needed to interact with the server (an example test
|
||||||
ws_server_example_test.py could be used as a simple WS client).
|
ws_server_example_test.py could be used as a simple WS 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.
|
||||||
|
@@ -20,9 +20,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
|
||||||
|
Reference in New Issue
Block a user