- Refactor WebSocket connection logic to dynamically fetch the port from the server, improving flexibility. - Introduce global variables to manage WebSocket server state and port, allowing for better control and error handling. - Update terminal drawer component to use the new port fetching mechanism, ensuring consistent connection behavior.