HamishBrindle / shitfacetime

ShitfaceTime is our drunken video chat application built on Laravel.
MIT License
0 stars 0 forks source link

User automatically disconnects from server on ANY error. Must reconnect if you can. #6

Closed Justin-Leung closed 6 years ago

Justin-Leung commented 6 years ago

Currently, when an error occurs its "AUTOMATICALLY" disconnected from the PeerJS server.

To work around this, always force a reconnect, or, maybe check to see if it's connected or not.

https://github.com/peers/peerjs/commit/141db74484d638a391c6bc1f64ee2620ffbcd963

Justin-Leung commented 6 years ago

Fixed, was destroying the PeerJS object everytime a user has an error. The fix was to remove that and add a reconnect for both the disabled and error emitted events. Also, within the error handler for the PeerJS object, I check if the error emitted was a peer-unavailable error and starts a new call.

That last part might be redundant, as on a reconnect I believe the 'open' emitted event handler is called which basically starts a call again.. Will check back later.