Fixing benchmark
This commit is contained in:
parent
a19edd4dc1
commit
e89ed8cca8
@ -2,6 +2,7 @@ import {RoomConnection} from "../front/src/Connexion/RoomConnection";
|
||||
import {connectionManager} from "../front/src/Connexion/ConnectionManager";
|
||||
import * as WebSocket from "ws"
|
||||
|
||||
let userMovedCount = 0;
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
@ -13,7 +14,7 @@ RoomConnection.setWebsocketFactory((url: string) => {
|
||||
|
||||
async function startOneUser(): Promise<void> {
|
||||
await connectionManager.anonymousLogin(true);
|
||||
const connection = await connectionManager.connectToRoomSocket(process.env.ROOM_ID ? process.env.ROOM_ID : '_/global/maps.workadventure.localhost/Floor0/floor0.json', 'TEST', ['male3'],
|
||||
const onConnect = await connectionManager.connectToRoomSocket(process.env.ROOM_ID ? process.env.ROOM_ID : '_/global/maps.workadventure.localhost/Floor0/floor0.json', 'TEST', ['male3'],
|
||||
{
|
||||
x: 783,
|
||||
y: 170
|
||||
@ -24,6 +25,12 @@ async function startOneUser(): Promise<void> {
|
||||
right: 800
|
||||
});
|
||||
|
||||
const connection = onConnect.connection;
|
||||
|
||||
connection.onUserMoved(() => {
|
||||
userMovedCount++;
|
||||
})
|
||||
|
||||
console.log(connection.getUserId());
|
||||
|
||||
let angle = Math.random() * Math.PI * 2;
|
||||
@ -46,6 +53,7 @@ async function startOneUser(): Promise<void> {
|
||||
|
||||
await sleep(10000);
|
||||
connection.closeConnection();
|
||||
console.log('User moved count: '+userMovedCount);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
@ -57,4 +65,5 @@ async function startOneUser(): Promise<void> {
|
||||
// Wait 0.5s between adding users
|
||||
await sleep(125);
|
||||
}
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user