microsoft / microsoft/BotFramework-WebChat
Direct Line Speech adapters do not connect
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
Description
I'm having an issue when using the DirectLine Speech adapter in my Web Chat integration. I adapted a template that previously worked with the standard DirectLine (text) channel and configured the WebSocket connection on my App Service. While speech-to-text functionality appears to work, the bot integration doesn't seem to be functioning as expected. Specifically:
- The client sends the
webchat/joinevent (which my C# bot correctly receives and processes when use Directline Text). - The bot responds with a welcome message as a message activity.
- However, the welcome message and any subsequent activities from the bot are not rendered in the Web Chat UI. When I create with DirectLine Speech
Code to Reproduce
<script>
(async function () {
async function fetchCredentials() {
const res = await fetch("https://northeurope.api.cognitive.microsoft.com/sts/v1.0/issuetoken", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Content-Length": "0",
"Ocp-Apim-Subscription-Key": "SECRET"
}
});
if (!res.ok) {
throw new Error("Error al obtener el token de autorización.");
}
console.log("Token obtenido correctamente.");
return { authorizationToken: await res.text(), region: "northeurope" };
}
const adapters = await window.WebChat.createDirectLineSpeechAdapters({
fetchCredentials
});
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
console.log("Conexión establecida con Direct Line Speech, enviando evento 'webchat/join'");
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: {
language: "es-ES",
mail: "h@gmail.es",
client: "Cliente123",
centro: "CentroX",
ambito: "app",
traces: "logs"
}
}
});
}
return next(action);
});
window.WebChat.renderWebChat({
...adapters,
store,
webSpeechPonyfillFactory: window.WebChat.createBrowserWebSpeechPonyfillFactory()
}, document.getElementById('webchat'));
document.querySelector("#webchat > *").focus();
})().catch(err => console.error("Error al inicializar Web Chat:", err));
</script>
Expected Behavior
- Once the connection is established and the
webchat/joinevent is sent, the bot should respond with a welcome message. - The welcome message (and any subsequent bot activities) should render in the Web Chat UI.
Actual Behavior
- Although the event is sent and received by the bot, no welcome message or other bot activities are displayed in the Web Chat interface when using the DirectLine Speech adapter.
Additional Context
- This integration works as expected with the standard DirectLine channel.
- I suspect the issue might be related to how the DirectLine Speech adapter handles or renders text-based activities, or any error creating the store.
- Any suggestions or known workarounds for ensuring that message activities are properly rendered in DirectLine Speech would be appreciated.
Please let me know if you need any further information or logs. Thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided Web Chat script and compare the DirectLine Speech adapter with the standard DirectLine channel. Trace the connection, webchat/join event, and incoming message activities; the issue is resolved when bot activities render in the Web Chat UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100