mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 11:43:59 -05:00
fix(websocket): error when leaving realtime-note
When a user left a realtime-note, the awareness tried to send events even after the socket was closed, resulting in the app crashing. This fix adds the check that the socket is still open before sending any messages. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
26d9bf4dde
commit
1938b6eefe
1 changed files with 1 additions and 1 deletions
|
@ -51,7 +51,7 @@ export class WebsocketConnection extends WebsocketTransporter {
|
|||
private bindYDocEvents(doc: Doc): void {
|
||||
doc.on('destroy', () => this.disconnect())
|
||||
doc.on('update', (update: Uint8Array, origin: unknown) => {
|
||||
if (origin !== this && this.isSynced()) {
|
||||
if (origin !== this && this.isSynced() && this.isWebSocketOpen()) {
|
||||
this.send(encodeDocumentUpdateMessage(update))
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue