@spatialwalk/avatarkit
Version:
SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK
50 lines • 1.32 kB
TypeScript
import { EventEmitter } from './utils/eventEmitter';
export interface AnimationWebSocketClientOptions {
wsUrl: string;
reconnectAttempts?: number;
debug?: boolean;
jwtToken?: string;
}
export declare class AnimationWebSocketClient extends EventEmitter {
private wsUrl;
private reconnectAttempts;
private debug;
private jwtToken?;
private ws;
private currentCharacterId;
private currentRetryCount;
private isConnecting;
private isManuallyDisconnected;
private reconnectTimer;
constructor(options: AnimationWebSocketClientOptions);
/**
* 连接WebSocket
*/
connect(characterId: string): Promise<void>;
/**
* 断开连接
*/
disconnect(): void;
/**
* 发送音频数据
*/
sendAudioData(reqId: string, audioData: ArrayBuffer, end: boolean): boolean;
/**
* 生成请求ID
* 使用统一的 ReqID 生成规则:YYYYMMDDHHmmss_nanoid
*/
generateReqId(): string;
/**
* 获取连接状态
*/
isConnected(): boolean;
/**
* 获取当前角色ID
*/
getCurrentCharacterId(): string;
private buildWebSocketUrl;
private connectWebSocket;
private handleMessage;
private scheduleReconnect;
}
//# sourceMappingURL=AnimationWebSocketClient.d.ts.map