Simple-peer. Cannot signal after peer is destroyed

1k views Asked by At

This seems to be a quite common issue with Simple-peer. I have simple video chat app which connects 2 peers using WebRTC, Socket.io and Simple-peer. When I peer 1 calls Peer 2 for the first time, everything is fine. Same with 2nd call (so reconnection isn't an issue) but the 3rd time it throws an error

Uncaught Error: cannot signal after peer is destroyed

I'm not destroying the peer in my code either end i.e. no peer.destroy() being called either end.

My question is, if there are 2 users logged into the app. can they stay logged in and call each other repeatedly without having to refresh/reload the app?

Or is the Socket.id that's issued to each new user that needs refreshing before each call?

In other terms -- If 2 peers made a connection, had a video call and ended the call. Is there a way to reconstruct the peer object between the same 2 peers for a new call without refreshing/reloading the app?

Many thanks in advance. Sorry I haven't included the code because I thought its more of a concept question.

0

There are 0 answers