API reference / @jsprismarine/client / Fleet
Class: Fleet
Defined in: client/src/bot/Fleet.ts:52
A fleet of synthetic players, and the numbers they produce.
The unit of a load test is the fleet rather than the bot: what is being measured is a server's behavior under N connections, and every number worth having - login latency percentiles, throughput, how many made it - is a property of the population.
Everything random is derived from one seed, so two runs against the same server differ because the server did, not because the bots chose differently.
Example
const fleet = new Fleet({ host: '127.0.0.1', count: 50, behaviors: ['walk', 'chat'], seed: 1234 });
await fleet.connect();
await fleet.run(60_000);
console.log(formatReport(fleet.report()));Constructors
Constructor
new Fleet(
options):Fleet
Defined in: client/src/bot/Fleet.ts:62
Parameters
options
Returns
Fleet
Methods
connect()
connect():
Promise<void>
Defined in: client/src/bot/Fleet.ts:104
Connects every bot, at the configured rate, and starts them ticking.
A bot that fails to connect is recorded and left out rather than aborting the run: "how many of five hundred got in" is usually the answer being looked for, and a fleet that gives up on the first refusal cannot report it.
Returns
Promise<void>
getBots()
getBots(): readonly
Bot[]
Defined in: client/src/bot/Fleet.ts:89
Returns
readonly Bot[]
getConnectedBots()
getConnectedBots():
Bot[]
Defined in: client/src/bot/Fleet.ts:93
Returns
Bot[]
report()
report():
FleetReport
Defined in: client/src/bot/Fleet.ts:137
Returns
run()
run(
durationMs):Promise<void>
Defined in: client/src/bot/Fleet.ts:127
Lets the fleet run for a while, then stops it.
Parameters
durationMs
number
Returns
Promise<void>
stop()
stop():
void
Defined in: client/src/bot/Fleet.ts:132
Returns
void