Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Cómo escuchar un evento personalizado enviado por una biblioteca de terceros en VUE JS

Estoy implementando agora chat en vue js donde hay un objeto que emite 6 eventos. ¿Cómo puedo escucharlos en VUE JS? Aquí está su código en javascript central:

 this.agora.conn = new AC.connection({
 appKey: this.agora.appKey,
 });


 this.agora.conn.addEventHandler("connection&message", {
 // Occurs when the app is connected to Agora Chat.
 onConnected: () => {
 console.log("App connected.");
 },
 // Occurs when the app is disconnected from Agora Chat.
 onDisconnected: () => {
 console.log("App disconnected.")
 },
 // Occurs when a text message is received.
 onTextMessage: (message) => {
 console.log("Message Recieved: ",message);
 },
 // Occurs when the token is about to expire.
 onTokenWillExpire: (params) => {
 console.log("Token is about to expire. ",params)
 this.refreshToken(this.agora.username, this.agora.password);
 },
 // Occurs when the token has expired. You need to get a token from your app server to log in to Agora Chat.
 onTokenExpired: (params) => {
 console.log("Token is expired. ",params)
 this.refreshToken(this.agora.username, this.agora.password);
 },
 onError: (error) => {
 console.log("on error: ", error);
 },
 });

Aquí, agora es el miembro de datos en el componente y este código anterior está en el enlace montado. He notado que la consola SDK está enviando los eventos, pero este oyente no está detectando ninguno. Aquí está el miembro de datos de agora:

 agora : {
 baseUrl : "https://a41.chat.agora.io",
 appKey : "******",
 username : "fana",
 password: "123",
 conn : null
 }
almost 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!