Installation
The SDK ships as a single npm package, dual-published for Node and browser environments. It is written in TypeScript with type definitions included.
npm / pnpm / yarn
Section titled “npm / pnpm / yarn”npm install realtimeodds# orpnpm add realtimeodds# oryarn add realtimeoddsThe package is published on the public npm registry: realtimeodds.
TypeScript
Section titled “TypeScript”No additional setup required. Types are bundled.
import { createClient, type SportEvent } from 'realtimeodds'Node version
Section titled “Node version”The SDK targets Node 18+ (uses the global WebSocket API in newer versions, falls back to ws automatically in the Node bundle).
Browser
Section titled “Browser”A browser-targeted bundle is selected automatically by your bundler via the package.json exports map. Tested with Vite, webpack 5, esbuild, and Rollup. The browser bundle uses the native WebSocket global.
What you also need
Section titled “What you also need”- A WebSocket gateway URL — typically
wss://api.realtimeodds.xyz. - An API key — see Authentication.
Once you have those, head to the Quickstart.