Skip to content

API reference / @jsprismarine/client / LoginSequence

Class: LoginSequence ​

Defined in: client/src/login/LoginSequence.ts:82

The join, from the first packet to standing in the world.

Written as one object with one promise rather than as handlers scattered across the client, because the sequence is genuinely a sequence: each step is only valid after the one before it, and every one of the four ways it can fail - refused, kicked, timed out, wrong version - has to end up at the same place. A caller gets await login() and either a spawned player or an error that says why.

The steps, and who speaks:

client  RequestNetworkSettings      uncompressed, and the last one that is
server  NetworkSettings             uncompressed; compression is on from here
client  Login                       the JWT chain and the client data
server  PlayStatus(LoginSuccess)
server  ResourcePacksInfo
client  ResourcePackResponse(HaveAllPacks)
server  ResourcePackStack
client  ResourcePackResponse(Completed)
server  StartGame, and a great deal else
server  PlayStatus(PlayerSpawn)
client  SetLocalPlayerAsInitialized

Constructors ​

Constructor ​

new LoginSequence(session, auth, logger, options): LoginSequence

Defined in: client/src/login/LoginSequence.ts:91

Parameters ​

session ​

ClientSession

auth ​

IAuthProvider

logger ​

Logger

options ​

LoginSequenceOptions

Returns ​

LoginSequence

Methods ​

getStage() ​

getStage(): LoginStage

Defined in: client/src/login/LoginSequence.ts:98

Returns ​

LoginStage


onTransportClosed() ​

onTransportClosed(reason): void

Defined in: client/src/login/LoginSequence.ts:124

Called when the transport dies under us, so the promise does not hang until timeout.

Parameters ​

reason ​

string

Returns ​

void


run() ​

run(): Promise<LoginResult>

Defined in: client/src/login/LoginSequence.ts:103

Runs the sequence, resolving once the server has spawned us.

Returns ​

Promise<LoginResult>