CMA link response time issues

We are having the same issue again: the CMA link can take over a minute to respond. It’s the same problem I mentioned a month go in this ticket that seems to be closed now: Inconsistent response times . So I created this new ticket as I can’t seem to add to the old one.

We can’t submit this demo to our client, so we can’t get paid. Can you please help? Thank you.

Hello @Tanguy_Dewavrin,

We are checking, thanks.

Thank you for your response, keep me posted!

1 Like

@Tanguy_Dewavrin are you testing on this website?

Yes, that’s the one. It’s taking forever to respond.

hey we tested your character with your config was working fine for me can you share the convai-web-sdk version you are using

Hey @Tanguy_Dewavrin,

Did you check?

Hello, sorry I was off for a few days. I am finding out this info for you now.

1 Like

convai-web-sdk@0.1.5

1 Like

@jerome,

Could you please update it to the latest version? Don’t forget to take a backup.

Also make sure to use sendTextStream method instead of sendTextChunk

Thanks K3 and Surav for the suggestons. Heres what we just tried:

  1. Updating the convai-web-sdk package to 1.3.0 (we deleted node_modules, bumped the version in package.json and ran npm install)
  2. Replaced sendTextChunk to sendTextStream and send some data

Doing this, we got no response in the usual client.setResponseCallback function.

I’ve attached a video of this process so you can see the initialisation of the convaiClient object, the setting of the response callback and the sending of the text, just in case we’re missing something.

We also bumped the version down to 1.2.0 and kept the same sendTextChunk function to see if that worked, but again we got no response.

For now, we’re going to create a completely separate test project using 1.3.0 and build upon it using the npm example code and see if we can identify where the problem might be. Will keep you updated on results, thanks.

`import { useState, useEffect, useRef } from “react”;
import { ConvaiClient } from “convai-web-sdk”;

export default function App() {
const [apiKey] = useState(“”);
const [characterId] = useState(“”);

// Direct ConvaiClient usage
const clientRef = useRef<ConvaiClient | null>(null);
const [isTyping, setIsTyping] = useState(false);

// Initialize client
useEffect(() => {
if (!characterId || !apiKey) return;

// Create client
clientRef.current = new ConvaiClient({
  apiKey,
  characterId,
  enableAudio: true,
  languageCode: "en-US",
});

// Set up callbacks
const client = clientRef.current;

// Error callback
client.setErrorCallback?.((type: string, statusMessage: string) => {
  console.error("Convai error:", type, statusMessage);
});

// Response callback
client.setResponseCallback?.((response: any) => {
  console.log("Response received:", response);
});

return () => {
  clientRef.current = null;
};

}, [characterId, apiKey]);

// Test sendTextStream functionality
const testSendTextStream = () => {
if (!clientRef.current) {
console.log(“Client not initialized”);
return;
}
clientRef.current.sendTextStream?.(“Hello, this is a test message!”);
};

const testInvokeTrigger = () => {
if (!clientRef.current) {
console.log(“Client not initialized”);
return;
}

console.log("Invoking trigger...");

try {
  clientRef.current.invokeTrigger?.("score goal");
} catch (error) {
  console.error("Error invoking trigger:", error);
}

};

return (

Convai Client - Simple Test
  <div style={{ marginTop: '20px' }}>
    <button
      onClick={testSendTextStream}
      style={{
        padding: '10px 20px',
        backgroundColor: '4CAF50_1',
        color: 'white',
        border: 'none',
        borderRadius: '5px',
        marginRight: '10px'
      }}
    >
      Test sendTextStream
    </button>

    <button
      onClick={testInvokeTrigger}
      style={{
        padding: '10px 20px',
        backgroundColor: '2196F3_1',
        color: 'white',
        border: 'none',
        borderRadius: '5px'
      }}
    >
      Test invokeTrigger
    </button>
  </div>

  <div style={{ marginTop: '20px', fontSize: '14px', color: '#666' }}>
    <div>Typing: {isTyping ? 'Yes' : 'No'}</div>
    <div>Check the browser console for logs and responses.</div>
  </div>
</div>

);
}`

@here, Are you still experiencing any issues? If you want, you could also try testing with your original (older) SDK version.

It is working now, but we are not sure why. We just recreated the character from scratch (i.e. created a new character with a different character ID in the Convai dashboard) and it works faster now.

1 Like