UNPKG

2.21 kBTypeScriptView Raw
1import { Deserialize, Serialize, ServiceDefinition } from './make-client';
2import { HandleCall } from './server-call';
3import { ServerCredentials } from './server-credentials';
4import { ChannelOptions } from './channel-options';
5import { ServerRef } from './channelz';
6export type UntypedHandleCall = HandleCall<any, any>;
7export interface UntypedServiceImplementation {
8 [name: string]: UntypedHandleCall;
9}
10export declare class Server {
11 private http2ServerList;
12 private handlers;
13 private sessions;
14 private started;
15 private options;
16 private serverAddressString;
17 private readonly channelzEnabled;
18 private channelzRef;
19 private channelzTrace;
20 private callTracker;
21 private listenerChildrenTracker;
22 private sessionChildrenTracker;
23 private readonly maxConnectionAgeMs;
24 private readonly maxConnectionAgeGraceMs;
25 private readonly keepaliveTimeMs;
26 private readonly keepaliveTimeoutMs;
27 constructor(options?: ChannelOptions);
28 private getChannelzInfo;
29 private getChannelzSessionInfoGetter;
30 private trace;
31 addProtoService(): never;
32 addService(service: ServiceDefinition, implementation: UntypedServiceImplementation): void;
33 removeService(service: ServiceDefinition): void;
34 bind(port: string, creds: ServerCredentials): never;
35 bindAsync(port: string, creds: ServerCredentials, callback: (error: Error | null, port: number) => void): void;
36 forceShutdown(): void;
37 register<RequestType, ResponseType>(name: string, handler: HandleCall<RequestType, ResponseType>, serialize: Serialize<ResponseType>, deserialize: Deserialize<RequestType>, type: string): boolean;
38 unregister(name: string): boolean;
39 start(): void;
40 tryShutdown(callback: (error?: Error) => void): void;
41 addHttp2Port(): never;
42 /**
43 * Get the channelz reference object for this server. The returned value is
44 * garbage if channelz is disabled for this server.
45 * @returns
46 */
47 getChannelzRef(): ServerRef;
48 private _verifyContentType;
49 private _retrieveHandler;
50 private _respondWithError;
51 private _channelzHandler;
52 private _streamHandler;
53 private _runHandlerForCall;
54 private _setupHandlers;
55}