|
@@ -86,5 +86,33 @@ export class ConnectController extends BasicController {
|
|
|
// }
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // benmark
|
|
|
+ this.socket.on("client-benmark-server", (data) => {
|
|
|
+ const roomId = this.roomController.roomId;
|
|
|
+ this.socket.broadcast.to(roomId).emit("server-benmark-client", data);
|
|
|
+ });
|
|
|
+ let serverIntervalRoomBroadcast = false;
|
|
|
+ let serverIntervalRoomBroadcastTimer = null;
|
|
|
+ this.socket.on("server-interval-room-broadcast", ({ time }) => {
|
|
|
+ const roomId = this.roomController.roomId;
|
|
|
+ if (!serverIntervalRoomBroadcast) {
|
|
|
+ serverIntervalRoomBroadcast = true;
|
|
|
+ const data = {
|
|
|
+ message: "定时benmark-播报",
|
|
|
+ timestamp: new Date(),
|
|
|
+ };
|
|
|
+ serverIntervalRoomBroadcastTimer = setInterval(() => {
|
|
|
+ this.socket.broadcast.to(roomId).emit("client-interval-room-broadcast", data);
|
|
|
+ }, time | 1000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.socket.on("server-interval-room-broadcast-cancel", () => {
|
|
|
+ if (serverIntervalRoomBroadcastTimer) {
|
|
|
+ clearInterval(serverIntervalRoomBroadcastTimer);
|
|
|
+ serverIntervalRoomBroadcast = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|