class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
constructor(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
protected logger: Logger
protected clients: Map<string, any>
protected url: string
protected grpcClients: GrpcClient[]
status: never
protected options: Required<GrpcOptions>['options']
getService<T extends object>(name: string): T
getClientByServiceName<T = unknown>(name: string): T
createClientByServiceName(name: string)
getKeepaliveOptions()
createServiceMethod(client: any, methodName: string): (...args: unknown[]) => Observable<unknown>
createStreamServiceMethod(client: unknown, methodName: string): (...args: any[]) => Observable<any>
createUnaryServiceMethod(client: any, methodName: string): (...args: any[]) => Observable<any>
createClients(): any[]
loadProto(): any
lookupPackage(root: any, packageName: string)
close()
connect(): Promise<any>
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
protected getClient(name: string): any
protected publish(packet: any, callback: (packet: any) => any): any
protected dispatchEvent(packet: any): Promise<any>
on<EventKey extends never = never, EventCallback = any>(event: EventKey, callback: EventCallback)
unwrap<T>(): T
protected routingMap: Map<string, Function>
protected serializer: ProducerSerializer
protected deserializer: ProducerDeserializer
protected _status$: ReplaySubject<Status>
status: Observable<Status>
abstract connect(): Promise<any>
abstract close(): any
on<EventKey extends keyof EventsMap = keyof EventsMap, EventCallback extends EventsMap[EventKey] = EventsMap[EventKey]>(event: EventKey, callback: EventCallback)
abstract unwrap<T>(): T
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
emit<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
protected abstract publish(packet: ReadPacket<any>, callback: (packet: WritePacket<any>) => void): () => void
protected abstract dispatchEvent<T = any>(packet: ReadPacket<any>): Promise<T>
protected createObserver<T>(observer: Observer<T>): (packet: WritePacket) => void
protected serializeError(err: any): any
protected serializeResponse(response: any): any
protected assignPacketId(packet: ReadPacket<any>): ReadPacket & PacketId
protected connect$(instance: any, errorEvent: string = 'error', connectEvent: string = 'connect'): Observable<any>
protected getOptionsProp<Options extends ClientOptions['options'], Attribute extends keyof Options, DefaultValue extends Options[Attribute] = Options[Attribute]>(obj: Options, prop: Attribute, defaultValue: DefaultValue = undefined as DefaultValue)
protected normalizePattern(pattern: MsPattern): string
protected initializeSerializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
protected initializeDeserializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
}
Constructor
constructor(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
Parameters
Option |
Type |
Description |
options
|
{ url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData... |
|
|
Properties
Property |
Description |
protected logger: Logger
|
Read-only.
|
protected clients: Map<string, any>
|
Read-only.
|
protected url: string
|
Read-only.
|
protected grpcClients: GrpcClient[]
|
|
status: never
|
Read-only.
|
protected options: Required<GrpcOptions>['options']
|
Read-only.
Declared in constructor.
|
Methods
getService()
|
getService<T extends object>(name: string): T
Parameters
Option |
Type |
Description |
name
|
string |
|
Returns
T
|
getClientByServiceName()
|
getClientByServiceName<T = unknown>(name: string): T
Parameters
Option |
Type |
Description |
name
|
string |
|
Returns
T
|
createClientByServiceName()
|
createClientByServiceName(name: string)
Parameters
Option |
Type |
Description |
name
|
string |
|
|
getKeepaliveOptions()
|
getKeepaliveOptions()
Parameters
There are no parameters.
|
createServiceMethod()
|
createServiceMethod(client: any, methodName: string): (...args: unknown[]) => Observable<unknown>
Parameters
Option |
Type |
Description |
client
|
any |
|
methodName
|
string |
|
Returns
(...args: unknown[]) => Observable<unknown>
|
createStreamServiceMethod()
|
createStreamServiceMethod(client: unknown, methodName: string): (...args: any[]) => Observable<any>
Parameters
Option |
Type |
Description |
client
|
unknown |
|
methodName
|
string |
|
Returns
(...args: any[]) => Observable<any>
|
createUnaryServiceMethod()
|
createUnaryServiceMethod(client: any, methodName: string): (...args: any[]) => Observable<any>
Parameters
Option |
Type |
Description |
client
|
any |
|
methodName
|
string |
|
Returns
(...args: any[]) => Observable<any>
|
createClients()
|
createClients(): any[]
Parameters
There are no parameters.
Returns
any[]
|
loadProto()
|
loadProto(): any
Parameters
There are no parameters.
Returns
any
|
lookupPackage()
|
lookupPackage(root: any, packageName: string)
Parameters
Option |
Type |
Description |
root
|
any |
|
packageName
|
string |
|
|
close()
|
close()
Parameters
There are no parameters.
|
connect()
|
connect(): Promise<any>
Parameters
There are no parameters.
Returns
Promise<any>
|
send()
|
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
Parameters
Option |
Type |
Description |
pattern
|
any |
|
data
|
TInput |
|
Returns
Observable<TResult>
|
getClient()
|
protected getClient(name: string): any
Parameters
Option |
Type |
Description |
name
|
string |
|
Returns
any
|
publish()
|
protected publish(packet: any, callback: (packet: any) => any): any
Parameters
Option |
Type |
Description |
packet
|
any |
|
callback
|
(packet: any) => any |
|
Returns
any
|
dispatchEvent()
|
protected dispatchEvent(packet: any): Promise<any>
Parameters
Option |
Type |
Description |
packet
|
any |
|
Returns
Promise<any>
|
on()
|
on<EventKey extends never = never, EventCallback = any>(event: EventKey, callback: EventCallback)
Parameters
Option |
Type |
Description |
event
|
EventKey |
|
callback
|
EventCallback |
|
|
unwrap()
|
unwrap<T>(): T
Parameters
There are no parameters.
Returns
T
|