Improving benchmark
This commit is contained in:
parent
54fd429952
commit
9ec5dc093c
@ -2,6 +2,7 @@ import {RoomConnection} from "../front/src/Connexion/RoomConnection";
|
|||||||
import {connectionManager} from "../front/src/Connexion/ConnectionManager";
|
import {connectionManager} from "../front/src/Connexion/ConnectionManager";
|
||||||
import * as WebSocket from "ws"
|
import * as WebSocket from "ws"
|
||||||
|
|
||||||
|
|
||||||
function sleep(ms) {
|
function sleep(ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
@ -11,15 +12,18 @@ RoomConnection.setWebsocketFactory((url: string) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function startOneUser(): Promise<void> {
|
async function startOneUser(): Promise<void> {
|
||||||
const connection = await connectionManager.connectToRoomSocket();
|
await connectionManager.anonymousLogin(true);
|
||||||
connection.emitPlayerDetailsMessage('foo', ['male3']);
|
const connection = await connectionManager.connectToRoomSocket('_/global/maps.workadventure.localhost/Floor0/floor0.json', 'TEST', ['male3'],
|
||||||
|
{
|
||||||
|
x: 783,
|
||||||
|
y: 170
|
||||||
|
}, {
|
||||||
|
top: 0,
|
||||||
|
bottom: 200,
|
||||||
|
left: 500,
|
||||||
|
right: 800
|
||||||
|
});
|
||||||
|
|
||||||
await connection.joinARoom('global__maps.workadventure.localhost/Floor0/floor0', 783, 170, 'down', true, {
|
|
||||||
top: 0,
|
|
||||||
bottom: 200,
|
|
||||||
left: 500,
|
|
||||||
right: 800
|
|
||||||
});
|
|
||||||
console.log(connection.getUserId());
|
console.log(connection.getUserId());
|
||||||
|
|
||||||
let angle = Math.random() * Math.PI * 2;
|
let angle = Math.random() * Math.PI * 2;
|
||||||
|
2282
benchmark/package-lock.json
generated
2282
benchmark/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -76,10 +76,12 @@ class ConnectionManager {
|
|||||||
await Axios.get(`${API_URL}/verify`, {params: {token}});
|
await Axios.get(`${API_URL}/verify`, {params: {token}});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async anonymousLogin(): Promise<void> {
|
public async anonymousLogin(isBenchmark: boolean = false): Promise<void> {
|
||||||
const data = await Axios.post(`${API_URL}/anonymLogin`).then(res => res.data);
|
const data = await Axios.post(`${API_URL}/anonymLogin`).then(res => res.data);
|
||||||
this.localUser = new LocalUser(data.userUuid, data.authToken, []);
|
this.localUser = new LocalUser(data.userUuid, data.authToken, []);
|
||||||
localUserStore.saveUser(this.localUser);
|
if (!isBenchmark) { // In benchmark, we don't have a local storage.
|
||||||
|
localUserStore.saveUser(this.localUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public initBenchmark(): void {
|
public initBenchmark(): void {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
|
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
|
||||||
const API_URL = (typeof(window) !== 'undefined' ? window.location.protocol : 'http:') + '//' + (process.env.API_URL || "api.workadventure.localhost");
|
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "api.workadventure.localhost");
|
||||||
const TURN_SERVER: string = process.env.TURN_SERVER || "turn:numb.viagenie.ca";
|
const TURN_SERVER: string = process.env.TURN_SERVER || "turn:numb.viagenie.ca";
|
||||||
const TURN_USER: string = process.env.TURN_USER || 'g.parant@thecodingmachine.com';
|
const TURN_USER: string = process.env.TURN_USER || 'g.parant@thecodingmachine.com';
|
||||||
const TURN_PASSWORD: string = process.env.TURN_PASSWORD || 'itcugcOHxle9Acqi$';
|
const TURN_PASSWORD: string = process.env.TURN_PASSWORD || 'itcugcOHxle9Acqi$';
|
||||||
|
Loading…
Reference in New Issue
Block a user