Skip to content

Allow websocket parameters to be given in the Realtime Model #2234

@aligokalppeker

Description

@aligokalppeker

Describe the feature

When connected through the WebSocket, any disconnection due to network conditions may result in the loss of specific session information.

To avoid disconnection through flaky network conditions or make the client more robust to the disconnections, the WebSocket client might require having its client parameters updated, such as ping_interval, ping_timeout, and sock (for keep-alive enabled TCP sockets).

Can we add an optional websocket settings field to the RealtimeModelConfig, allowing users to set their own client settings to maintain connections for different network connections?

class TransportConfig(TypedDict):
    """Low-level network transport configuration."""

    ping_interval: NotRequired[float | None]
    """Time in seconds between keepalive pings sent by the client. 
    Default is usually 20.0. Set to None to disable."""

    ping_timeout: NotRequired[float | None]
    """Time in seconds to wait for a pong response before disconnecting.
    Set to None to enable 'Zombie Mode' (ignore network lag)."""

    connect_timeout: NotRequired[float]
    """Time in seconds to wait for the connection handshake to complete."""


class RealtimeModelConfig(TypedDict):
    """Options for connecting to a realtime model."""
   .....
   
   transport: NotRequired[TransportConfig]
    """Low-level transport settings for timeouts and TCP socket configuration."""

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions