Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
TurnContext in microsoft bot builder is giving error when fetching data from WebSocket server

I want to show the response coming from WebSocket server to emulator that is Microsoft Bot Builder but I am having a issue that inside ws.addEventListener. Here is the code

ws.addEventListener('message',async function (event) {
                const msg = JSON.parse(event.data);
                if(msg.topic === 'aws/chat' && msg.contentType === 'application/json'){
                    const content = JSON.parse(msg.content);
                    switch(content.Type){
                        case 'MESSAGE':
                            try{
                                  if(content.ParticipantRole !== 'CUSTOMER'){
                                    responseMessage = `${content.DisplayName} : ${content.Content}`;
                                    console.log(`responseMessage :- ${responseMessage}`);
                                    await turnContext.sendActivity(responseMessage);
                                }
                            }catch(error){
                                console.log("Insise Error");
                                console.log(error);
                            }
                            break;
                        case 'Event':
                            if(content.ContentType.includes('ended')){
                                responseMessage = `Chat ended`;
                            }
                    }
                }
            });

When I debugged await turnContext.sendActivity(responseMessage) is loosing scope inside the listener function and not able to return the response to the emulator.

From WS server receiving response and getting printed in console with error.

responseMessage :- BOT : To speak to an agent, press or say # Insise Error TypeError: Cannot perform 'get' on a proxy that has been revoked at WebSocket. (D:\azure-bot\echo-bot\bots\stateManagementBot.js:155:59)

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda