kodi-api
Version:
A complete implementation of Kodi JSON-RPC calls in an easy-to-use Javascript/TypeScript client.
29 lines (28 loc) • 1.09 kB
TypeScript
import type { RequestParamsLike, JSONRPCIDLike } from 'jayson/promise';
export interface WebSocketClientOptions {
host?: string;
port?: number;
closeOnRequest?: boolean;
}
/** Custom class for web socket interactions with JSON-RPC. */
export declare class WebSocketClient {
constructor(options?: WebSocketClientOptions);
/** Indicates that a request is a singleton operation. */
private closeOnRequest;
private connected;
private ignoreJsonErrors;
private url;
private io;
/** Caches the last used id. */
private lastId;
/** Caches the next id, passed to the `request` method. */
private nextId;
/** Closely matches the type from Jayson/promise import. */
request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike): Promise<any>;
/** Custom unique ID function following internal state. */
private id;
/** Manage custom connection logic. */
connect(url?: string): Promise<void>;
/** Manage graceful disconnect from web socket. */
disconnect(): Promise<void>;
}