Skip to content

Function: createChannelEndpoint()

Makaio Framework


Makaio Framework / bus-core / createChannelEndpoint

createChannelEndpoint(context, endpointName, callback, options): ChannelEndpoint

Defined in: ../../../packages/bus-core/src/channel/channel-endpoint.ts:66

Register a channel endpoint that accepts encrypted point-to-point connections.

Listens for system.channel.open requests. When a request arrives for this endpoint name with the correct token:

  1. Performs the ECDH key exchange (generates a keypair, derives the shared secret).
  2. Instantiates an IDirectChannel for the endpoint side.
  3. Calls callback so the endpoint can register its channel-scoped handlers.
  4. Returns the channel ID and the endpoint public key to the client.

Multiple endpoints can coexist on the same bus context; each handles only requests whose payload.endpoint matches its own name.

MakaioBusContext

Bus context to register the endpoint handler on

string

Logical name for this endpoint (e.g., ‘credentials’)

(channel) => void

Called with the new IDirectChannel once the handshake is complete; use this to register channel handlers before the client receives the handshake response

ChannelEndpointOptions

Endpoint options including the shared capability token

ChannelEndpoint

A ChannelEndpoint handle whose close() unregisters the endpoint