remove remote pointers on client disconnect

This commit is contained in:
dwelle 2020-03-11 22:30:00 +01:00
parent 2db2f3f5e4
commit 96320478e6

View File

@ -340,6 +340,12 @@ export class App extends React.Component<any, AppState> {
this.socket.on("room-user-count", (collaboratorCount: number) => {
this.setState({ collaboratorCount });
});
this.socket.on("client-disconnected", (socketID: number) => {
this.setState(state => {
const { [socketID]: omit, ...remotePointers } = state.remotePointers;
return { remotePointers };
});
});
this.socket.on("new-user", async (socketID: string) => {
this.broadcastSocketData({
type: "SCENE_UPDATE",