Cloudflare - v1.3.0
    Preparing search index...

    Class DurableObjectService<E>

    Coordination capability, backed by Durable Objects.

    A name maps to exactly one object, so concurrent requests for the same name queue behind each other instead of racing — that is the whole point of reaching for this rather than KV or D1.

    Requests reach an object through its stub's fetch, so the URLs below are addressed to the object, not to the internet. The object class itself must be exported from the Worker entry and declared as a migration in wrangler.json.

    Bayu Dwiyan Satria

    1.0.0

    1.0.0

    Type Parameters

    Implements

    • CoordinationStore<E>
    Index
    • Calls the object that owns a name and parses its JSON reply.

      Type Parameters

      • T = unknown

      Parameters

      • env: E

        The Worker environment.

      • name: string

        The name identifying the object — a room, a tenant, a session.

      • path: string

        Path on the object, e.g. /increment.

      • init: RequestInit = {}

        Request options, such as { method: 'POST' }.

      Returns Promise<T>

      The object's parsed response.

      Error When the object replies with a non-OK status.

    • Creates a fresh object and returns the id needed to reach it again.

      Use this when the caller — not a name — owns the identity: a new session, a new game, a new upload.

      Parameters

      • env: E

        The Worker environment.

      Returns string

      The new object's id, as a string.

    • Reports whether the namespace is bound to this Worker.

      Parameters

      • env: E

        The Worker environment.

      Returns boolean

      true when the binding is present.