
    g*                     D    d dl mZmZmZmZ ddlmZmZ dZ G d d      Z	y)    )AnyDictListOptional   )RealtimeChannelOptionsSyncRealtimeChannelzkThis feature isn't available in the sync client. You can use the realtime feature in the async client only.c                       e Zd Z	 	 	 	 	 ddedededeeeef      dedede	d	dfd
Z
	 ddedee   d	efdZd	ee   fdZded	dfdZddZdee   d	dfdZy)SyncRealtimeClientNurltokenauto_reconnectparamshb_intervalmax_retriesinitial_backoffreturnc                      y)aY  
        Initialize a RealtimeClient instance for WebSocket communication.

        :param url: WebSocket URL of the Realtime server. Starts with `ws://` or `wss://`.
                    Also accepts default Supabase URL: `http://` or `https://`.
        :param token: Authentication token for the WebSocket connection.
        :param auto_reconnect: If True, automatically attempt to reconnect on disconnection. Defaults to False.
        :param params: Optional parameters for the connection. Defaults to an empty dictionary.
        :param hb_interval: Interval (in seconds) for sending heartbeat messages to keep the connection alive. Defaults to 30.
        :param max_retries: Maximum number of reconnection attempts. Defaults to 5.
        :param initial_backoff: Initial backoff time (in seconds) for reconnection attempts. Defaults to 1.0.
        N )selfr   r   r   r   r   r   r   s           J/var/www/openai/venv/lib/python3.12/site-packages/realtime/_sync/client.py__init__zSyncRealtimeClient.__init__	           topicc                      t        t              )z
        :param topic: Initializes a channel and creates a two-way association with the socket
        :return: Channel
        NotImplementedErrorNOT_IMPLEMENTED_MESSAGE)r   r   r   s      r   channelzSyncRealtimeClient.channel    s     ""9::r   c                      t        t              Nr   r   s    r   get_channelszSyncRealtimeClient.get_channels)   s    !"9::r   r    c                      t        t              )z
        Unsubscribes and removes a channel from the socket
        :param channel: Channel to remove
        :return: None
        r   )r   r    s     r   remove_channelz!SyncRealtimeClient.remove_channel,   s     ""9::r   c                      t        t              )z]
        Unsubscribes and removes all channels from the socket
        :return: None
        r   r#   s    r   remove_all_channelsz&SyncRealtimeClient.remove_all_channels4   s    
 ""9::r   c                      y)a  
        Set the authentication token for the connection and update all joined channels.

        This method updates the access token for the current connection and sends the new token
        to all joined channels. This is useful for refreshing authentication or changing users.

        Args:
            token (Optional[str]): The new authentication token. Can be None to remove authentication.

        Returns:
            None
        Nr   )r   r   s     r   set_authzSyncRealtimeClient.set_auth;   r   r   )TN      g      ?r"   )r   N)__name__
__module____qualname__strboolr   r   r   intfloatr   r   r	   r    r   r$   r&   r(   r*   r   r   r   r   r      s    
  $+/!$  	
 c3h(    
0 FJ;;"*+A"B;	;;d#67 ;;&9 ;d ;;hsm  r   r   N)
typingr   r   r   r   r    r   r	   r   r   r   r   r   <module>r5      s!    , , @ H ? ?r   