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
Why peer connection state doesnt change from new?

I am working with webRTC and wrtc on the server. My client side code is :

 React.useEffect(() => {
    (async () => {
      pc = new RTCPeerConnection()
      const offer = await pc.createOffer()
      await pc.setLocalDescription(offer)
      const { data } = await axios.post('http://localhost:3000/testing', { sdp: pc.localDescription })
      await pc.setRemoteDescription(data.sdp)
  
    })()
    setInterval(() => {
      console.log(pc.connectionState)
    }, 2222);
  }, []);

And the server side is :

server.post('/testing', async function (req, res) {
  const { sdp } = req.body
  const pc = new webrtc.RTCPeerConnection()
    await pc.setRemoteDescription(sdp)
    const answer = await pc.createAnswer()
    await pc.setLocalDescription(answer)
    res.status(200).json({ sdp: pc.localDescription })
})

pc.connectionState indicates new and apparently I am not connected. Where is my mistake?

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

0

You are not adding any tracks or a datachannel hence your SDP contains no m= sections, no ice candidates are gathered and nothing useful happens.

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!