Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda