add ws.close() to websocket examples

This commit is contained in:
RandomGitUser321 2024-09-22 04:12:53 -04:00 committed by GitHub
parent 5718ef69bb
commit d5b3a0d692
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,7 +154,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: