Tashi SDK method reference
Modules: tashi.init, tashi.session, tashi.netcode, tashi.anticheat.
tashi.init
Initializes the SDK. Call once before other methods. Returns a Promise when connected to Tashi Cloud.
Signature
function init(options: InitOptions): Promise<void>
interface InitOptions {
gameId: string; // required
apiKey: string; // required
region?: string; // optional, default 'auto'
debug?: boolean; // optional, default false
}
tashi.session
Manages game sessions. Use one session per match. Each session separately stores analytics and anti-cheat signals.
session.start(options)
function start(options: SessionOptions): Promise<Session>
interface SessionOptions {
players: string[]; // required, player IDs
mode?: string; // optional, game mode label
region?: string; // optional, override init region
}
interface Session {
id: string;
startedAt: Date;
players: string[];
}
session.end(sessionId)
Ends a session and sends remaining analytics to Tashi Cloud. Returns a Promise when recorded.
await Tashi.session.end(sessionId: string): Promise<void>
tashi.netcode
Controls lag compensation and jitter buffering. Configure once per server process. Settings affect later sessions.
netcode.configure(options)
function configure(options: NetcodeOptions): void
interface NetcodeOptions {
mode?: 'static' | 'adaptive';
baseCompensation?: number; // ms, default 80
maxCompensation?: number; // ms, default 300
tickRate?: number; // Hz, default 30
jitterBuffer?: {
enabled?: boolean; // default true
target?: number | 'auto'; // ms or auto
min?: number; // ms, default 20
max?: number; // ms, default 200
};
adaptationRate?: 'slow' | 'auto' | 'fast';
}
tashi.anticheat
Manages behavioral analysis and detection rules. Off by default. Call enable() to use defaults.
anticheat.enable()
Tashi.anticheat.enable(): void
Enables detection signals with default thresholds. Call after initialization and before the first session.
anticheat.configure(options)
interface AnticheatOptions {
signals?: {
velocityAnomaly?: SignalConfig;
positionTeleport?: SignalConfig;
inputTiming?: SignalConfig;
statOutlier?: SignalConfig;
};
reviewQueue?: boolean;
}
interface SignalConfig {
enabled?: boolean;
threshold?: number; // 0.0 to 1.0
}
Events
Listen for SDK events with .on(event, callback). Remove listeners with .off(event, callback).
| Event | Module | Payload |
|---|---|---|
flag |
anticheat |
{ playerId, signal, confidence, sessionId } |
end |
session |
{ sessionId, duration, playerCount } |
player:join |
session |
{ sessionId, playerId } |
player:leave |
session |
{ sessionId, playerId } |
Error codes
SDK errors extend TashiError and include code for programmatic handling.
| Code | Meaning |
|---|---|
AUTH_FAILED |
Invalid or missing API key |
GAME_NOT_FOUND |
Game ID does not exist in the account |
CCU_LIMIT |
Concurrent user limit reached for current tier |
SESSION_NOT_FOUND |
Session ID passed to end() is not active |
NOT_INITIALIZED |
SDK method called before init() completed |