handle unexpected disconnect flow

This commit is contained in:
Kevin Jahns 2019-05-20 14:12:35 +02:00
parent 1eb06079de
commit 2e92786bf0

View File

@ -72,8 +72,10 @@ class WSSharedDoc extends Y.Doc {
const changedClients = added.concat(updated, removed) const changedClients = added.concat(updated, removed)
if (conn !== null) { if (conn !== null) {
const connControlledIDs = /** @type {Set<number>} */ (this.conns.get(conn)) const connControlledIDs = /** @type {Set<number>} */ (this.conns.get(conn))
added.forEach(clientID => { connControlledIDs.add(clientID) }) if (connControlledIDs !== undefined) {
removed.forEach(clientID => { connControlledIDs.delete(clientID) }) added.forEach(clientID => { connControlledIDs.add(clientID) })
removed.forEach(clientID => { connControlledIDs.delete(clientID) })
}
} }
// broadcast awareness update // broadcast awareness update
const encoder = encoding.createEncoder() const encoder = encoding.createEncoder()