Close the WebSocket connection and join the WebSocket thread. First attempts to close the WebSocket connection using `self.client_socket.close()`. After closing the connection, it joins the WebSocket thread to ensure proper termination.
(self)
| 348 | print(e) |
| 349 | |
| 350 | def close_websocket(self): |
| 351 | """ |
| 352 | Close the WebSocket connection and join the WebSocket thread. |
| 353 | |
| 354 | First attempts to close the WebSocket connection using `self.client_socket.close()`. After |
| 355 | closing the connection, it joins the WebSocket thread to ensure proper termination. |
| 356 | |
| 357 | """ |
| 358 | try: |
| 359 | self.client_socket.close() |
| 360 | except Exception as e: |
| 361 | print("[ERROR]: Error closing WebSocket:", e) |
| 362 | |
| 363 | try: |
| 364 | self.ws_thread.join() |
| 365 | except Exception as e: |
| 366 | print("[ERROR:] Error joining WebSocket thread:", e) |
| 367 | |
| 368 | def get_client_socket(self): |
| 369 | """ |
no outgoing calls