diff --git a/script_examples/websockets_api_example.py b/script_examples/websockets_api_example.py index 5e80aace682..d696d2bba2c 100644 --- a/script_examples/websockets_api_example.py +++ b/script_examples/websockets_api_example.py @@ -154,7 +154,7 @@ def get_images(ws, prompt): ws = websocket.WebSocket() ws.connect("ws://{}/ws?clientId={}".format(server_address, client_id)) images = get_images(ws, prompt) - +ws.close() # for in case this example is used in an environment where it will be repeatedly called, like in a Gradio app. otherwise, you'll randomly receive connection timeouts #Commented out code to display the output images: # for node_id in images: diff --git a/script_examples/websockets_api_example_ws_images.py b/script_examples/websockets_api_example_ws_images.py index b37d9893ddb..6508ecc99e7 100644 --- a/script_examples/websockets_api_example_ws_images.py +++ b/script_examples/websockets_api_example_ws_images.py @@ -147,7 +147,7 @@ def get_images(ws, prompt): ws = websocket.WebSocket() ws.connect("ws://{}/ws?clientId={}".format(server_address, client_id)) images = get_images(ws, prompt) - +ws.close() # for in case this example is used in an environment where it will be repeatedly called, like in a Gradio app. otherwise, you'll randomly receive connection timeouts #Commented out code to display the output images: # for node_id in images: