Make the mouse location broadcast volatile (#1331)
This commit is contained in:
parent
2852610960
commit
d5899f6ca0
@ -172,13 +172,14 @@ class Portal {
|
|||||||
data: SocketUpdateDataSource[keyof SocketUpdateDataSource] & {
|
data: SocketUpdateDataSource[keyof SocketUpdateDataSource] & {
|
||||||
_brand: "socketUpdateData";
|
_brand: "socketUpdateData";
|
||||||
},
|
},
|
||||||
|
volatile: boolean = false,
|
||||||
) {
|
) {
|
||||||
if (this.isOpen()) {
|
if (this.isOpen()) {
|
||||||
const json = JSON.stringify(data);
|
const json = JSON.stringify(data);
|
||||||
const encoded = new TextEncoder().encode(json);
|
const encoded = new TextEncoder().encode(json);
|
||||||
const encrypted = await encryptAESGEM(encoded, this.roomKey!);
|
const encrypted = await encryptAESGEM(encoded, this.roomKey!);
|
||||||
this.socket!.emit(
|
this.socket!.emit(
|
||||||
"server-broadcast",
|
volatile ? "server-volatile-broadcast" : "server-broadcast",
|
||||||
this.roomID,
|
this.roomID,
|
||||||
encrypted.data,
|
encrypted.data,
|
||||||
encrypted.iv,
|
encrypted.iv,
|
||||||
@ -994,6 +995,7 @@ export class App extends React.Component<any, AppState> {
|
|||||||
};
|
};
|
||||||
return this.portal._broadcastSocketData(
|
return this.portal._broadcastSocketData(
|
||||||
data as typeof data & { _brand: "socketUpdateData" },
|
data as typeof data & { _brand: "socketUpdateData" },
|
||||||
|
true, // volatile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user