TeaSpeak-Client/imports/shared-app/ipc/BrowserIPC.d.ts

56 lines
2.0 KiB
TypeScript

import "broadcastchannel-polyfill";
import { ConnectHandler } from "../ipc/ConnectHandler";
export interface BroadcastMessage {
timestamp: number;
receiver: string;
sender: string;
type: string;
data: any;
}
export interface ChannelMessage {
channel_id: string;
type: string;
data: any;
}
export interface ProcessQueryResponse {
request_timestamp: number;
request_query_id: string;
device_id: string;
protocol: number;
}
export interface CertificateAcceptCallback {
request_id: string;
}
export interface CertificateAcceptSucceeded {
}
export declare abstract class BasicIPCHandler {
protected static readonly BROADCAST_UNIQUE_ID = "00000000-0000-4000-0000-000000000000";
protected static readonly PROTOCOL_VERSION = 1;
protected registeredChannels: IPCChannel[];
protected localUniqueId: string;
protected constructor();
setup(): void;
getLocalAddress(): string;
abstract sendMessage(type: string, data: any, target?: string): any;
protected handleMessage(message: BroadcastMessage): void;
createChannel(targetId?: string, channelId?: string): IPCChannel;
channels(): IPCChannel[];
deleteChannel(channel: IPCChannel): void;
private _query_results;
queryProcesses(timeout?: number): Promise<ProcessQueryResponse[]>;
private _cert_accept_callbacks;
register_certificate_accept_callback(callback: () => any): string;
private _cert_accept_succeeded;
post_certificate_accpected(id: string, timeout?: number): Promise<void>;
}
export interface IPCChannel {
readonly channelId: string;
targetClientId?: string;
messageHandler: (remoteId: string, broadcast: boolean, message: ChannelMessage) => void;
sendMessage(type: string, message: any, target?: string): any;
}
export declare function setup(): void;
export declare function getIpcInstance(): BasicIPCHandler;
export declare function getInstanceConnectHandler(): ConnectHandler;
export declare function supported(): boolean;