export type RpcEndpointSyncVoid = RpcEndpointBase; export interface RpcEndpointSync extends RpcEndpointBase { readonly bufferSize: number; } export interface RpcEndpointAsync extends RpcEndpointBase { readonly hasReturnTransfer: false; } export interface RpcEndpointAsyncWithTransfer extends RpcEndpointBase { readonly hasReturnTransfer: true; } export type RpcEndpointAsyncVoid = RpcEndpointBase; export interface RpcEndpointBase { /** * The name of this rpc endpoint. * Rpc instance use this name to recognize which callback to call. * Keep in mind: this should be unique. * @public */ readonly name: string; /** * @private * make typescript happy */ readonly _TypeParameters: Parameters; /** * @private * make typescript happy */ readonly _TypeReturn: Return; /** * @public * if this endpoint has return value. * Only valid for sync endpoints. * Always true for async endpoints. */ readonly hasReturn: HasReturn; /** * @public * the call is a async call or not */ readonly isSync: IsSync; /** * The byte size for return value buffer. * The return value will be encoded to json string in utf-8 * So you should ensure this size is enough for your stringified return value. */ readonly bufferSize: never | number; /** * @public * Make the message invoke created by hasReturn support transfer. * Only valid for async and hasReturn endpoints */ readonly hasReturnTransfer: never | boolean; } export type RpcEndpoint = RpcEndpointSyncVoid | RpcEndpointSync | RpcEndpointAsync | RpcEndpointAsyncVoid | RpcEndpointAsyncWithTransfer; export declare function createRpcEndpoint(name: string, isSync: false, hasReturn: false): RpcEndpointAsyncVoid; export declare function createRpcEndpoint(name: string, isSync: false, hasReturn: true): RpcEndpointAsync; export declare function createRpcEndpoint(name: string, isSync: false, hasReturn: true, hasReturnTransfer: false): RpcEndpointAsync; export declare function createRpcEndpoint(name: string, isSync: false, hasReturn: true, hasReturnTransfer: true): RpcEndpointAsyncWithTransfer; export declare function createRpcEndpoint(name: string, isSync: true, hasReturn: false): RpcEndpointSyncVoid; export declare function createRpcEndpoint(name: string, isSync: true, hasReturn: true, hasReturnTransfer: false, bufferSize: number): RpcEndpointSync;