> ## Documentation Index
> Fetch the complete documentation index at: https://docs.navtalk.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# conversation.connected.warning

> Connection warning event for non-critical issues (e.g., duplicate avatar names)

## Overview

When the server detects non-critical issues during connection, it sends a separate `conversation.connected.warning` event immediately after the `conversation.connected.success` event to inform the client without terminating the connection.

## Event Structure

```json theme={null}
{
  "type": "conversation.connected.warning",
  "message": "Warning: Found 2 avatars with the same name 'MyAvatar'. Using the most recently updated one (avatarId: abc-123)"
}
```

## Event Properties

<ResponseField name="type" type="string">
  Event type. Always `"conversation.connected.warning"` for this event.
</ResponseField>

<ResponseField name="message" type="string">
  Warning message describing the non-critical issue that occurred.

  **Example**: `"Warning: Found 2 avatars with the same name 'MyAvatar'. Using the most recently updated one (avatarId: abc-123)"`
</ResponseField>

## When This Event is Sent

This event is sent immediately after `conversation.connected.success` when non-critical issues are detected during the connection process.

## Common Scenarios

### Duplicate Avatar Names

When connecting using the `name` parameter and multiple avatars share the same name, the server will:

1. Automatically select the most recently updated avatar (based on `updated_at` timestamp)
2. Send `conversation.connected.success` event first
3. Send `conversation.connected.warning` event with details about the duplicate names and which avatar was selected
4. Continue with the connection normally

## Usage Example

```javascript theme={null}
const NavTalkMessageType = Object.freeze({
    CONNECTED_SUCCESS: "conversation.connected.success",
    CONNECTED_WARNING: "conversation.connected.warning",
    // ... other event types
});

async function handleReceivedMessage(data) {
    switch (data.type) {
        case NavTalkMessageType.CONNECTED_SUCCESS:
            const sessionId = data.data.sessionId;
            const iceServers = data.data.iceServers;
            
            // Configure WebRTC with ICE servers
            const configuration = { iceServers: iceServers };
            peerConnection = new RTCPeerConnection(configuration);
            
            console.log("Connection successful, sessionId:", sessionId);
            break;
        
        case NavTalkMessageType.CONNECTED_WARNING:
            const warningMsg = data.message || 'Connection warning';
            console.warn('Connection warning:', warningMsg);
            // Display warning to user (e.g., toast notification)
            displayWarning(warningMsg);
            break;
    }
}
```

## Message Sequence

When a warning occurs, you will receive events in this order:

1. `conversation.connected.success` - Connection established successfully
2. `conversation.connected.warning` - Warning about non-critical issue
3. Other events continue normally (e.g., `realtime.session.created`)

## Best Practices

* Always handle warning messages in your application
* Display warnings to users so they are aware of potential issues
* Consider using `avatarId` instead of `name` to avoid duplicate name scenarios
* Log warning messages for debugging purposes

## Related Events

* [`conversation.connected.success`](/api/real-time-digital-human-api/websocket-events/connection-events/conversation-connected-success) - Sent before this warning event
