Skip to content

Interface: HttpServerLike

Makaio Framework


Makaio Framework / contracts / HttpServerLike

Defined in: ../../../packages/contracts/src/capabilities/server/types.ts:38

Minimal Node-compatible HTTP server interface for WebSocket upgrade handling and port resolution.

This contract models servers that expose Node’s upgrade event. Bun’s native Bun.Server uses server.upgrade(request) from the fetch handler instead, so Bun hosts should expose WebSocket routing through a Bun-specific host seam rather than returning Bun.Server as HttpServerLike.

address(): string | ServerAddress | null

Defined in: ../../../packages/contracts/src/capabilities/server/types.ts:67

Return the bound address of the server.

Returns null when the server is not yet listening. Returns a ServerAddress when bound to a TCP port. The string case (Unix domain socket) is not used by the relay but is included for compatibility with Node.js Server#address() callers.

string | ServerAddress | null

Server address, pipe path string, or null


off(event, handler): void

Defined in: ../../../packages/contracts/src/capabilities/server/types.ts:56

Remove a previously attached event handler from the server.

Only the 'upgrade' event is required by this contract.

"upgrade"

The event name to remove the handler from.

UpgradeHandler

The handler to remove.

void


on(event, handler): void

Defined in: ../../../packages/contracts/src/capabilities/server/types.ts:47

Attach an event handler to the server.

Only the 'upgrade' event is required by this contract; implementors may support additional events via overloads.

"upgrade"

The event name to listen for.

UpgradeHandler

The handler to invoke when the event fires.

void