Added removal of nickname on connection error

This commit is contained in:
Mitchell McCaffrey 2020-03-26 13:30:39 +11:00
parent 4e94567f52
commit d2ca6cc177

View File

@ -118,6 +118,9 @@ function Game() {
})); }));
} }
}); });
connection.on("error", () => {
setNicknames(prevNicknames => omit(prevNicknames, [connection.peer]));
});
connection.send({ connection.send({
id: "nickname", id: "nickname",
data: { [peerId]: currentNicknameRef.current } data: { [peerId]: currentNicknameRef.current }