UNPKG

@betit/orion

Version:

Pluggable microservice framework

37 lines (36 loc) 934 B
import { Codec, Transport, Options } from '../types/interfaces'; /** * Provides an interface to make requests to services. */ export default class Client { protected options: Options; protected codec: Codec; protected transport: Transport; /** * Create new client. */ constructor(options?: Options); /** * Publish to a topic. * @param {any} topic * @param {Object} message */ emit(topic: string, message: any): void; /** * Call service method. * @param {Object} request * @param {Object} [params] * @param {Function} callback */ call(request: any, params?: any, callback?: Function): any; getCallTimeout(path: string, params: any): any; /** * Close underlying transport connection. */ close(): void; /** * Connection closed handler * @param {Function} callback */ onClose(callback: any): void; }