Restate Typescript SDK
    Preparing search index...

    Handle returned by connect: the outbound connection to Restate Cloud serving your services.

    interface Connection {
        name: string;
        ready: Promise<void>;
        close(): Promise<void>;
        shutdown(opts?: { graceMs?: number }): Promise<void>;
    }
    Index

    Properties

    Methods

    Properties

    name: string

    The deployment name, as configured.

    ready: Promise<void>

    Resolves when the first handshake succeeds (the deployment is reachable from Restate Cloud and can be registered); rejects if the connection stops on a non-retryable failure before ever connecting. Useful for readiness checks; safe to ignore.

    Methods

    • Stop reconnecting, close the current connections, and wait for teardown. Rejects with the fatal error if the connection had already stopped on a non-retryable failure (e.g. Restate Cloud rejected the key or the name).

      Returns Promise<void>

    • Gracefully drain, then stop. Proactively sends HTTP/2 GOAWAY so Restate Cloud stops opening new streams, refuses any raced streams with a drain sentinel, lets in-flight invocations finish — bounded by graceMs (default ConnectionOptions.drainGraceMs) — and then closes the session gracefully. If the grace elapses first, the session/socket are force-closed. The default ConnectionOptions.gracefulShutdown handler wires this to SIGTERM; close is the abrupt alternative. Rejects like close if the connection had already stopped on a non-retryable failure.

      Parameters

      • Optionalopts: { graceMs?: number }

      Returns Promise<void>