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

146
Views
cómo cambiar eventName con socket.io

Use Socket.io Me gustaría usar state para manejar los eventos que mi socket también está escuchando. El problema es que una vez que se establece el nombre del evento del socket, no puedo cambiarlo. Lo que espero hacer es hacer que socket.io escuche eventos con eventName start. Luego, si se presiona un botón, socket.io escuchará eventos con un nuevo nombre de evento diferente

 state = { channel:'start' }; componentDidMount() { // .. lots of other stuff apiListener() } apiListener = () => { mySocket.on(this.state.channel, data => { console.log(data) }) } render(){ return( <View> <Button onPress={()=> setState({channel: 'great'})} /> <Button onPress={()=> setState({channel: 'better'})} /> </View> ) }
about 4 years ago · Juan Pablo Isaza
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!