(pipelineId: string)
| 2 | import { useWebSocketStore } from '../store/websocketStore'; |
| 3 | |
| 4 | export const useWebSocket = (pipelineId: string) => { |
| 5 | const { connect, disconnect } = useWebSocketStore(); |
| 6 | |
| 7 | useEffect(() => { |
| 8 | if (pipelineId) { |
| 9 | connect(pipelineId); |
| 10 | } |
| 11 | |
| 12 | return () => { |
| 13 | disconnect(); |
| 14 | }; |
| 15 | }, [pipelineId, connect, disconnect]); |
| 16 | }; |