From d5899f6ca073df2ea051b6d94ec5af480d438f02 Mon Sep 17 00:00:00 2001 From: Edwin Lin Date: Thu, 9 Apr 2020 02:13:32 -0700 Subject: [PATCH] Make the mouse location broadcast volatile (#1331) --- src/components/App.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 11061683..911755a5 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -172,13 +172,14 @@ class Portal { data: SocketUpdateDataSource[keyof SocketUpdateDataSource] & { _brand: "socketUpdateData"; }, + volatile: boolean = false, ) { if (this.isOpen()) { const json = JSON.stringify(data); const encoded = new TextEncoder().encode(json); const encrypted = await encryptAESGEM(encoded, this.roomKey!); this.socket!.emit( - "server-broadcast", + volatile ? "server-volatile-broadcast" : "server-broadcast", this.roomID, encrypted.data, encrypted.iv, @@ -994,6 +995,7 @@ export class App extends React.Component { }; return this.portal._broadcastSocketData( data as typeof data & { _brand: "socketUpdateData" }, + true, // volatile ); } };