useLiveMatch
Subscribes to a single match over WebSocket, score, status, and clock update in real time as the match progresses.
Wraps matches.subscribe(). Pushes score, status, and clock updates in
place as stats.upd / status.upd events arrive, for as long as the
component stays mounted.
Installation
pnpm dlx shadcn@latest add https://mrdoge.co/r/use-live-match.jsonAlso requires MRDOGE_ODDS_API_KEY. Set it in your own environment after installing.
Installing this pulls in two files: the hook itself (a thin re-export
from @mrdoge/react, which does the
real work) and a Next.js route at app/api/mrdoge/token/route.ts that
mints short-lived tokens using @mrdoge/node and your own
MRDOGE_ODDS_API_KEY. The browser client never sees the raw key.
Usage
import { useLiveMatch } from "@/hooks/use-live-match"
const match = useLiveMatch({ matchId })Takes a single options object, like every real SDK method it wraps
(matches.subscribe(params)), not positional arguments.
Parameters
Prop
Type
Returns
MatchDetail | null | undefined: undefined while loading (or while
matchId is undefined), null if the subscribe failed (no fallback data;
an honest empty state beats a fake one), otherwise the current snapshot,
updated in place as stats.upd / status.upd events arrive. Feed it into
matchToMatchCardProps or
matchToMatchHighlightProps
for component props.