From 369672f0c1222fb4be9b15da40970a5b42f2775e Mon Sep 17 00:00:00 2001 From: RandomGitUser321 Date: Sun, 22 Sep 2024 04:13:29 -0400 Subject: [PATCH] add and explain ws.close() in websocket examples --- script_examples/websockets_api_example_ws_images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script_examples/websockets_api_example_ws_images.py b/script_examples/websockets_api_example_ws_images.py index b37d9893d..6508ecc99 100644 --- a/script_examples/websockets_api_example_ws_images.py +++ b/script_examples/websockets_api_example_ws_images.py @@ -147,7 +147,7 @@ prompt["3"]["inputs"]["seed"] = 5 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: