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

155
Views
Javascript-Socket.io is sending null query param at first attempt to connect server

I am trying to create a voice chat application in React.js. My problem is about sending parameters when users try to join room.

In client side, I run this code to connect server with access token

let accessToken = localStorage.getItem("accessToken")
    socket.current = io.connect(process.env.REACT_APP_SOCKET_URL+"/room",{query: { token:accessToken}})
    

But at first attempt to join room, token is sending as null to server but accessToken variable is not null when I print it to console. Whenever user refreshes the page and tries to join the room again, the token is sending successfully.

Do you have any idea why I am not able to send this variable at first attempt ?

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!