Files
docmost-ryan/apps/client/src/features/websocket/use-query-emit.ts
Philipinho 8cc7d39146 websocket updates
* sync page title on icon via websocket
* sync on page tree too
2024-04-27 15:40:22 +01:00

12 lines
326 B
TypeScript

import { socketAtom } from "@/features/websocket/atoms/socket-atom.ts";
import { useAtom } from "jotai";
import { WebSocketEvent } from "@/features/websocket/types";
export const useQueryEmit = () => {
const [socket] = useAtom(socketAtom);
return (input: WebSocketEvent) => {
socket?.emit("message", input);
};
};