Skip to content
Browse documentation
typescript sdk

Streaming, errors and cancellation

Distinguish HTTP results from long-lived streams and keep cancellation separate from rollback.

Handle the failure you actually received

Use callResponse for status-aware results. SERVICE_PROBLEM identifies a validated host admission/readiness problem; APPLICATION_PROBLEM identifies a validated application problem. Neither is an arbitrary domain DTO.

INVALID_RESPONSE covers malformed, oversized or undeclared responses, including invalid success bodies. Invalid local request input rejects before transport. A transport failure does not prove a business operation failed. Do not show raw diagnostics to users.

import {
  ServiceClientRequestError,
  ServiceClientResponseError,
  ServiceClientTransportError,
} from "@smoothie-framework/service/client";

Use native SSE explicitly

Elysia exposes SSE helpers; service/client/sse exposes subscribeToSse. These are host-level tools, not a contract-first streaming operation model.

import { subscribeToSse } from "@smoothie-framework/service/client/sse";
import { sse } from "@smoothie-framework/service-elysia/stream";

Your host defines event schemas, authorization, retention and reconnect behavior. Validate events before updating UI. A disconnected browser does not prove background work stopped.

Pass supported AbortSignals to requests and release subscriptions on disposal. Cancellation ends observation or cooperative work; it cannot reverse committed changes.