Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

refactor(book): drop orphaned openBookSocket after WS migration

Bingxi Zhao (Frank)26d388fc02b5
diff --git a/web/lib/book-api.ts b/web/lib/book-api.ts
index d297eac38..f8f6853ba 100644
--- a/web/lib/book-api.ts
+++ b/web/lib/book-api.ts
@@ -255,22 +255,5 @@ export async function getLegacyChatSession(
return (await res.json()) as LegacyChatSession;
}
-// ── WebSocket helper ─────────────────────────────────────────────────
-
+// Re-exported so callers can keep importing the event type from book-api.
export type { BookWsEvent } from "@/lib/book-ws-operation";
-
-export function openBookSocket(
- onEvent: (event: BookWsEvent) => void,
- onError?: (error: Event) => void,
-): WebSocket {
- const socket = new WebSocket(wsUrl(`${BASE}/ws`));
- socket.onmessage = (event) => {
- try {
- onEvent(JSON.parse(event.data));
- } catch {
- // ignore malformed frames
- }
- };
- if (onError) socket.onerror = onError;
- return socket;
-}