diff --git a/examples/protocols/http_server/ws_echo_server/README.md b/examples/protocols/http_server/ws_echo_server/README.md index 8fa4219337..011b14b22a 100644 --- a/examples/protocols/http_server/ws_echo_server/README.md +++ b/examples/protocols/http_server/ws_echo_server/README.md @@ -6,7 +6,8 @@ This example demonstrates the HTTPD server using the WebSocket feature. ## 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 -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 use of asynchronous send, which is triggered on reception of a certain message. diff --git a/examples/protocols/http_server/ws_echo_server/ws_server_example_test.py b/examples/protocols/http_server/ws_echo_server/ws_server_example_test.py index e44896bd31..54bfbfca99 100644 --- a/examples/protocols/http_server/ws_echo_server/ws_server_example_test.py +++ b/examples/protocols/http_server/ws_echo_server/ws_server_example_test.py @@ -20,9 +20,14 @@ import os import re import ttfw_idf -import websocket 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_BIN = 0x2 OPCODE_PING = 0x9