Skip to content

Commit

Permalink
Trying to fix intermittent connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
tyouwei committed Nov 13, 2024
1 parent b0f812e commit ff3254c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ const AudioSharing = () => {

peer.on('error', (err: Error) => {
console.error('Peer connection error:', err);
cleanupAudio(true);
setTimeout(() => {
cleanupAudio(true);
createPeer(stream, initiator); // Recreate the peer
}, 2000);
});

peer.on('close', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => {
prevClientsRef.current = newClients;
setConnectedClients(newClients);
}
}, 1000); // Debounce for 1 second
}, 5000); // Debounce for 1 second
};

const handleEditorMount = (editor: MonacoEditor.IStandaloneCodeEditor) => {
Expand Down Expand Up @@ -181,7 +181,7 @@ const CollaborationEditor = ({ matchId }: CollaborationEditorProps) => {
if (providerRef.current?.wsconnected) {
updateLocalAwareness();
}
}, 30000); // Refresh every 30 seconds
}, 5000);

return () => {
clearInterval(refreshInterval);
Expand Down

0 comments on commit ff3254c

Please sign in to comment.