|
@@ -7,7 +7,7 @@ const userStartId = process.argv[4];
|
|
|
const testSceneNum = process.argv[5] || "t-test";
|
|
|
const roomStartId = process.argv[6] || "00001";
|
|
|
const isMockCamera = process.argv[7] || 0;
|
|
|
-const cameraInterval = process.argv[8] || 3000;
|
|
|
+const cameraInterval = process.argv[8] || 100;
|
|
|
const roomNumber = process.argv[9] || 50;
|
|
|
let testCamera;
|
|
|
console.log(
|
|
@@ -108,36 +108,38 @@ const createClient = ({ userId, nickName, from, role, oid, roomId }) => {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
- // if (Number(isMockCamera) === 1 && Number(from) === 0) {
|
|
|
- // console.log(userId + "底层v3开启发送镜头");
|
|
|
- // setInterval(() => {
|
|
|
- // const data = {
|
|
|
- // testUserId: userId,
|
|
|
- // item: {
|
|
|
- // qua: {
|
|
|
- // _x: -0.11495106988815072,
|
|
|
- // _y: 0.13408027376477993,
|
|
|
- // _z: 0.015660797097947755,
|
|
|
- // _w: 0.9841562229407423,
|
|
|
- // },
|
|
|
- // mode: "panorama",
|
|
|
- // pos: {
|
|
|
- // x: 1.7477431297302246,
|
|
|
- // y: -0.1338435709476471,
|
|
|
- // z: 1.3797638416290283,
|
|
|
- // },
|
|
|
- // type: "Rotate",
|
|
|
- // pano: "1",
|
|
|
- // target: {
|
|
|
- // x: 1.4874317088952322,
|
|
|
- // y: -0.3643028004004215,
|
|
|
- // z: 0.442146378191566,
|
|
|
- // },
|
|
|
- // },
|
|
|
- // };
|
|
|
- // socket.emit("client to server event", data);
|
|
|
- // }, EMIT_INTERVAL_IN_MS_camera);
|
|
|
- // }
|
|
|
+ if (Number(isMockCamera) === 1 && Number(from) === 0 && role === "leader") {
|
|
|
+ console.log(
|
|
|
+ `房间${roomId} 房主${userId} from:${from}--> v3开启发送定时${cameraInterval}ms镜头`
|
|
|
+ );
|
|
|
+ setInterval(() => {
|
|
|
+ const data = {
|
|
|
+ testUserId: userId,
|
|
|
+ item: {
|
|
|
+ qua: {
|
|
|
+ _x: -0.11495106988815072,
|
|
|
+ _y: 0.13408027376477993,
|
|
|
+ _z: 0.015660797097947755,
|
|
|
+ _w: 0.9841562229407423,
|
|
|
+ },
|
|
|
+ mode: "panorama",
|
|
|
+ pos: {
|
|
|
+ x: 1.7477431297302246,
|
|
|
+ y: -0.1338435709476471,
|
|
|
+ z: 1.3797638416290283,
|
|
|
+ },
|
|
|
+ type: "Rotate",
|
|
|
+ pano: "1",
|
|
|
+ target: {
|
|
|
+ x: 1.4874317088952322,
|
|
|
+ y: -0.3643028004004215,
|
|
|
+ z: 0.442146378191566,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ socket.emit("webSyncAction", data);
|
|
|
+ }, cameraInterval);
|
|
|
+ }
|
|
|
|
|
|
// setInterval(() => {
|
|
|
// socket.emit("client to server event");
|
|
@@ -154,14 +156,16 @@ const createClient = ({ userId, nickName, from, role, oid, roomId }) => {
|
|
|
// console.log(`客户端${userId}收到房间播报-MOCK"`, data);
|
|
|
// });
|
|
|
|
|
|
- socket.on("server to client event", (data) => {
|
|
|
+ socket.on("webSyncAction", (data) => {
|
|
|
+ // console.log();
|
|
|
+ testCamera = `webSyncAction:${userId}收到-->${data.testUserId}的webSyncAction`;
|
|
|
packetsSinceLastReport++;
|
|
|
});
|
|
|
|
|
|
socket.on("disconnect", (reason) => {
|
|
|
console.log(`disconnect due to ${reason}`);
|
|
|
});
|
|
|
-
|
|
|
+ clientCount++;
|
|
|
// if (++clientCount < MAX_CLIENTS) {
|
|
|
// setTimeout(createAgent, CLIENT_CREATION_INTERVAL_IN_MS);
|
|
|
// }
|
|
@@ -181,14 +185,6 @@ groups(arr, chunkSize).forEach((group, gIndex) => {
|
|
|
const oid = `oid-${userStartId}${agent}`;
|
|
|
const roomId = `${roomStartId}${gIndex + 1}`;
|
|
|
let role = index === 0 ? "leader" : "customer";
|
|
|
- console.log("agent-2", {
|
|
|
- userId,
|
|
|
- nickName,
|
|
|
- role,
|
|
|
- oid,
|
|
|
- roomId,
|
|
|
- });
|
|
|
-
|
|
|
createClient({ userId, nickName, from: "0", role: role, oid, roomId });
|
|
|
createClient({ userId, nickName, from: "1", role: role, oid, roomId });
|
|
|
createClient({ userId, nickName, from: "2", role: role, oid, roomId });
|
|
@@ -197,6 +193,7 @@ groups(arr, chunkSize).forEach((group, gIndex) => {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
// createAgent();
|
|
|
|
|
|
const printReport = () => {
|
|
@@ -208,7 +205,7 @@ const printReport = () => {
|
|
|
|
|
|
console.log(
|
|
|
`client count: ${clientCount} ; average packets received per second: ${packetsPerSeconds} ${
|
|
|
- testCamera ? " carmera:" + JSON.stringify(testCamera) : ""
|
|
|
+ testCamera ? " carmera:" + testCamera : ""
|
|
|
}`
|
|
|
);
|
|
|
|
|
@@ -216,4 +213,4 @@ const printReport = () => {
|
|
|
lastReport = now;
|
|
|
};
|
|
|
|
|
|
-// setInterval(printReport, 5000);
|
|
|
+setInterval(printReport, 5000);
|