INNER CODE UNIT · TypeScript

parseMessage

rotki/rotki · frontend/app/src/modules/core/messaging/index.ts:22

function parseMessage(raw: unknown): WebsocketMessage | undefined {
  const parseResult = WebsocketMessage.safeParse(raw);
  if (!parseResult.success) {
    logger.warn('Invalid message format:', parseResult.error, raw);
    return undefined;
  }
  return parseResult.data;
}

interface UseMessageHandling {
  handleMessage: (data: string) => Promise<void>;
  consume: () => Promise<void>;
}

export function useMessageHandling(): UseMessageHandling {
  const { t } = useI18n({ useScope: 'global' });
  const router = useRouter();
  const { consumeMessages } = useSessionApi();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…