Skip to content

Protocols

Protocol plugin system for extending Connectum servers with custom gRPC services and HTTP endpoints.

Quick Start

typescript
import { createServer } from '@connectum/core';
import { Healthcheck } from '@connectum/healthcheck';
import { Reflection } from '@connectum/reflection';
import routes from '#gen/routes.js';

const server = createServer({
  services: [routes],
  port: 5000,
  protocols: [
    Healthcheck({ httpEnabled: true }),
    Reflection(),
  ],
});

await server.start();

Key Concepts

ConceptDescription
ProtocolRegistrationInterface with name, register(), and optional httpHandler
HealthcheckBuilt-in protocol -- gRPC Health Check + HTTP endpoints (/healthz, /health, /readyz)
ReflectionBuilt-in protocol -- gRPC Server Reflection for runtime service discovery
Custom ProtocolsImplement ProtocolRegistration to add gRPC services or HTTP endpoints
addProtocol()Add protocols dynamically before server.start()

Every protocol's register() receives a ConnectRouter and a ProtocolContext with all registered service file descriptors.

Learn More