Added socket disconnect on game unmount
This commit is contained in:
parent
77bb13e8e6
commit
c55e236a61
@ -105,6 +105,10 @@ class Session extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.socket.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send data to a single peer
|
||||
*
|
||||
|
@ -33,6 +33,10 @@ function Game() {
|
||||
await session.connect();
|
||||
}
|
||||
connect();
|
||||
|
||||
return () => {
|
||||
session.disconnect();
|
||||
};
|
||||
}, [session]);
|
||||
|
||||
// Handle session errors
|
||||
|
Loading…
Reference in New Issue
Block a user