Websocket Support (#159)

This commit is contained in:
Gregory Schier
2025-01-31 09:00:11 -08:00
committed by GitHub
parent d411713502
commit c8be8082c5
122 changed files with 5090 additions and 616 deletions

View File

@@ -0,0 +1,17 @@
import type { WebsocketConnection } from '@yaakapp-internal/models';
import { atom, useAtomValue } from 'jotai';
import { jotaiStore } from '../lib/jotai';
export const websocketConnectionsAtom = atom<WebsocketConnection[]>([]);
export function useWebsocketConnections() {
return useAtomValue(websocketConnectionsAtom);
}
export function useLatestWebsocketConnection(requestId: string | null): WebsocketConnection | null {
return useWebsocketConnections().find((r) => r.requestId === requestId) ?? null;
}
export function getWebsocketConnection(id: string) {
return jotaiStore.get(websocketConnectionsAtom).find((r) => r.id === id) ?? null;
}