UNPKG

@creditkarma/thrift-client

Version:

Thrift client library for NodeJS written in TypeScript.

30 lines (29 loc) 1 kB
/// <reference types="node" /> import { IProtocolConstructor, ITransportConstructor, LogFunction } from '@creditkarma/thrift-server-core'; import * as net from 'net'; import * as tls from 'tls'; export interface IConnectionConfig { port: number; hostName: string; timeout?: number; auth?: { username: string; password: string; }; ca?: Array<string>; https?: boolean; rejectUnauthorized?: boolean; tlsHostname?: string; } export declare class Connection { protected logger: LogFunction; private socket; private frameCodec; private _hasSession; constructor(socket: tls.TLSSocket | net.Socket, logger: LogFunction); hasSession(): boolean; destroy(): Promise<void>; send(dataToSend: Buffer, Transport: ITransportConstructor, Protocol: IProtocolConstructor): Promise<Buffer>; private initializeSocket; } export declare const createConnection: (config: IConnectionConfig, logger?: LogFunction) => Promise<Connection>;