diff --git a/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx b/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx index 03f9c6589..ca9dbbb6a 100644 --- a/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx +++ b/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx @@ -21,13 +21,21 @@ export const DockerLogsId: React.FC = ({ const wsRef = useRef(null); // Ref to hold WebSocket instance useEffect(() => { - if (containerId === "select-a-containe") { - return; - } + // if (containerId === "select-a-container") { + // return; + // } const container = document.getElementById(id); if (container) { container.innerHTML = ""; } + + if (wsRef.current) { + console.log(wsRef.current); + if (wsRef.current.readyState === WebSocket.OPEN) { + wsRef.current.close(); + } + wsRef.current = null; + } const termi = new Terminal({ cursorBlink: true, cols: 80, diff --git a/apps/dokploy/server/wss/docker-container-logs.ts b/apps/dokploy/server/wss/docker-container-logs.ts index c25fb931f..3557a71ad 100644 --- a/apps/dokploy/server/wss/docker-container-logs.ts +++ b/apps/dokploy/server/wss/docker-container-logs.ts @@ -33,6 +33,8 @@ export const setupDockerContainerLogsWebSocketServer = ( const tail = url.searchParams.get("tail"); const serverId = url.searchParams.get("serverId"); const { user, session } = await validateWebSocketRequest(req); + console.log(wssTerm.clients); + console.log(wssTerm.clients.size); if (!containerId) { ws.close(4000, "containerId no provided");