UNPKG

@wishcore/wish-sdk

Version:

Wish API for node. Used for building Wish Apps.

37 lines (36 loc) 1.05 kB
/// <reference types="node" /> import { Socket } from 'net'; import { SocketProtocol } from './protocol'; import { EventEmitter } from 'events'; import { Peer } from './peer'; export declare class App extends EventEmitter { private opts; name: string; tcp: Socket; protocol: SocketProtocol; protocols: string[]; host: string; port: number; private requestMap; id: number; peers: { [id: string]: Peer; }; private state; constructor(opts: { name: string; coreHost?: string; corePort: number; protocols?: string[]; }); send(peer: Peer, frame: Buffer): Promise<any>; requestAsync(op: string, args: any[]): Promise<any>; request(op: string, args: any[], cb?: any): number | Promise<any>; requestBare(op: string, args: any[], cb: any): number; connect(): Promise<void>; /** Cancel and/or terminate request by id */ cancel(requestId: number): void; private waitFrame; private createFrame; private createLoginFrame; }