WayloAIWaylo Docs
Web SDK

Measure start-up time

How long each step of start() took.

wayloVoice.on('state', state => {
  if (state.timings?.agentSpeakingMs !== undefined) console.info('agent speaking after', state.timings.agentSpeakingMs);
});

state.timings is unset before start(). Then it holds startedAt and, in whole milliseconds after start(), each step as it is reached. Every new step comes with a state event.

FieldMeaning
startedAtDate.now() when start() was called, i.e. the click.
sessionReadyMsYour session endpoint answered.
connectedMsThis browser joined the call.
microphoneOpenMsThe browser opened the microphone, permission prompt included. It opens while the call connects, so the time the visitor takes to allow it overlaps the earlier steps.
microphoneReadyMsThe microphone is live in the call, so the agent can hear the visitor.
agentReadyMsThe agent reported its first activity. start() resolves once the microphone is ready too.
agentSpeakingMsThe agent started speaking while playback is playing. Its audio arrives a few hundred milliseconds later. This is the visitor's wait to hear the agent.
  • A step not reached stays unset.
  • Steps can be reached out of order: the agent can be ready before the microphone.
  • If audio was blocked, agentSpeakingMs is set once resumeAudio() lets it play while the agent speaks, or at the agent's next turn.

Send them to your analytics. state.timings is for logging and monitoring; don't show it to visitors, show the call status instead.