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

112
Views
Configurar websocket para que siempre esté abierto

Uso este código para conectarme al socket web de NodeJS:

 useEffect(() => { let futureResponseFeedAddress = "ws://localhost:/endpoint"; const futureResponseClient = new W3CWebSocket(futureResponseFeedAddress); props.onUpdateOrderbookWebsocket(futureResponseClient); futureResponseClient.onopen = () => { console.log("WebSocket Client Connected on " + futureResponseFeedAddress); }; futureResponseClient.onmessage = (message) => { .............. }; futureResponseClient.onclose = closeEvent => { console.log("response messages websocket closed."); } return function cleanup() { futureResponseClient.close(); }; }, []);

Pero después de alrededor de 1-2 minutos, los mensajes no se reciben. Parece que tengo tiempo de espera. ¿Sabes cómo puedo configurar el web socket para que esté siempre abierto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Mi sugerencia es que debe usar socket.io para realizar cualquier comunicación en tiempo real. Utiliza sondeo largo de http, actualiza la conexión a websocket si es necesario y también tiene un buen soporte de navegador. Es mucho más fiable también. Pero hay algunos inconvenientes, su servidor necesita usar la api del servidor socket.io.

Socket.io-cliente

Socket.io-servidor

No hay necesidad de reinventar la rueda.

about 4 years ago · Juan Pablo Isaza Report
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!