ModuleRpcProtocolGrpcWebServer

Server-side implementation of the gRPC-Web protocol.

license

Copyright (c) Aiden.ai

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Index

Type aliases

ReportErrorHandler

ReportErrorHandler: function

Reports an error that occurred during the processing of an RPC request by an RPC server.

The function is not expected to throw. However, if it throws, the error is safely captured and outputted to the command line (avoiding an infinite loop).

param

The error to report.

param

Additional context surrounding this error.

Type declaration

Functions

registerGrpcWebRoutes

  • registerGrpcWebRoutes<serviceDefinition, RequestContext>(serviceDefinition: serviceDefinition, serviceHandler: ModuleRpcServer.ServiceHandlerFor<serviceDefinition, RequestContext>, serverContextConnector: ServerContextConnector<RequestContext>, options?: GrpcWebServerOptions<serviceDefinition>): Router
  • Registers the API routes of an RPC service for the gRPC-Web protocol.

    see

    registerRpcRoutes offers a more generic interface and is enough for most use cases.

    Type parameters

    • serviceDefinition: ServiceDefinition

      The definition of the service for which to implement a client.

    • RequestContext

    Parameters

    • serviceDefinition: serviceDefinition
    • serviceHandler: ModuleRpcServer.ServiceHandlerFor<serviceDefinition, RequestContext>

      The handler that actually implements each of the methods of the service.

    • serverContextConnector: ServerContextConnector<RequestContext>

      The context connector to use to inject metadata (such as authentication/authorization metadata) to the RPC. If one wishes to not inject any metadata, [[ModuleRpcContextServer.EmptyServerContextConnector]] can used.

    • Default value options: GrpcWebServerOptions<serviceDefinition> = {}

      Various options to change the behavior of the server, including logging.

    Returns Router