dial_sdk.events

Attributes

Classes

EventsConnection

A long-lived subscription to the account's event stream, consumed as an

Functions

events_user_id(→ str)

Derive the PubNub user_id from the grant channel (account-{accountId}).

Module Contents

class dial_sdk.events.EventsConnection(mint: MintGrant)

A long-lived subscription to the account’s event stream, consumed as an async iterator of event dicts.

This is the SDK’s idiom for what the CLI does one-shot with dial wait-for: instead of returning a single event, it yields every message.received / call.status_changed / call.ended / call.transcribed event on the account channel until the consumer stops iterating or the connection is closed. The PubNub token is silently re-minted before it expires, so a connection can stay open indefinitely. PubNub specifics (subscribe key, channel, token, TTL) are never surfaced to the caller.

Usage:

async with client.new_events_connection() as conn:
    async for event in conn:
        handle(event)
async close() None

Tear down the subscription and end iteration. Idempotent.

async open() EventsConnection

Mint the first token and establish the subscription. Idempotent.

dial_sdk.events.events_user_id(channel: str) str

Derive the PubNub user_id from the grant channel (account-{accountId}).

Dashboard, CLI, and SDKs all derive the same dial-{accountId} identity, so an account counts as one PubNub MAU no matter how many surfaces or processes it connects from.

dial_sdk.events.MintGrant