Package 

Class BaseConnection


  • 
    public abstract class BaseConnection
    
                        

    Abstract base class for network connections

    This provides a common interface for different transport types (WebRTC, WebSocket) while supporting event-driven architecture with observable state.

    • Constructor Detail

      • BaseConnection

        BaseConnection()
    • Method Detail

      • connect

         abstract Unit connect(String token, String serverUrl, ConversationConfig config)

        Establish a connection using the provided token and server URL

        Parameters:
        token - Authentication token for the connection
        serverUrl - URL of the server to connect to
        config - Conversation configuration
      • disconnect

         abstract Unit disconnect(DisconnectionDetails details)

        Disconnect from the server and clean up resources

        Parameters:
        details - Optional details about why the disconnection occurred.
      • sendMessage

         abstract Unit sendMessage(Object message)

        Send a message through the connection

        Parameters:
        message - The message to send (will be serialized as needed)
      • setOnMessageListener

         abstract Unit setOnMessageListener(Function1<String, Unit> listener)

        Set a listener for incoming messages

        Parameters:
        listener - Callback that receives incoming message strings