File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ You can close the connection.
103103Here's an example that terminates cleanly when it receives SIGTERM on Unix:
104104
105105.. literalinclude :: ../../example/faq/shutdown_client.py 
106-  :emphasize-lines:  10-12 
106+  :emphasize-lines:  10-14 
107107
108108How do I disable TLS/SSL certificate verification?
109109-------------------------------------------------- 
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ async def client():
99 async  with  connect ("ws://localhost:8765" ) as  websocket :
1010 # Close the connection when receiving SIGTERM. 
1111 loop  =  asyncio .get_running_loop ()
12-  loop .add_signal_handler (signal .SIGTERM , loop .create_task , websocket .close ())
12+  def  close ():
13+  return  loop .create_task (websocket .close ())
14+  loop .add_signal_handler (signal .SIGTERM , close )
1315
1416 # Process messages received on the connection. 
1517 async  for  message  in  websocket :
                                 You can’t perform that action at this time. 
               
                  
0 commit comments