Triggered when the WebSocket connection fails to establish or encounters an error during connection setup.
Event Properties
Event type. Always "conversation.connected.fail" for this event.
Error message describing the connection failure reason.Example: "Connection timeout" or "Invalid license key"
{
"type": "conversation.connected.fail",
"message": "Invalid license key"
}
Usage Example
const NavTalkMessageType = Object.freeze({
CONNECTED_FAIL: "conversation.connected.fail",
// ... other event types
});
async function handleReceivedMessage(data) {
switch (data.type) {
case NavTalkMessageType.CONNECTED_FAIL:
const errorMessage = data.message || "Connection failed";
showError(errorMessage);
// Clean up resources
cleanupResources();
break;
}
}
When this event is received, the WebSocket connection has failed. You should clean up any resources and inform the user of the error.