Skip to content

API reference / @jsprismarine/prismarine / player/context/SessionHandler

player/context/SessionHandler ​

Interfaces ​

ConnectionLaneHandler ​

Defined in: packages/prismarine/src/player/context/SessionHandler.ts:14

A connection-lane handler: it touches only its own session, and runs when its packet arrives.

Extends ​

Type Parameters ​

P ​

P

Properties ​

lane ​

readonly lane: "connection"

Defined in: packages/protocol/src/handler/PacketHandler.ts:41

When the handler runs relative to the world tick.

Inherited from ​

LaneHandler.lane

phases ​

readonly phases: readonly SessionPhase[]

Defined in: packages/protocol/src/handler/PacketHandler.ts:23

The session phases in which the packet is accepted. The side drops it in any other.

Inherited from ​

LaneHandler.phases

Methods ​

handle() ​

handle(packet, context): void | Promise<void>

Defined in: packages/protocol/src/handler/PacketHandler.ts:31

Handles one packet.

Parameters ​
packet ​

P

The decoded packet.

context ​

SessionContext

What the side hands the handler.

Returns ​

void | Promise<void>

Inherited from ​

LaneHandler.handle


InputLaneHandler ​

Defined in: packages/prismarine/src/player/context/SessionHandler.ts:23

An input-lane handler: applied synchronously in the input step of its sender's world, inside one unit of that world's change log, so a throw undoes what it wrote.

Extends ​

Type Parameters ​

P ​

P

Properties ​

lane ​

readonly lane: "input"

Defined in: packages/protocol/src/handler/PacketHandler.ts:41

When the handler runs relative to the world tick.

Inherited from ​

InputHandler.lane

phases ​

readonly phases: readonly SessionPhase[]

Defined in: packages/protocol/src/handler/PacketHandler.ts:23

The session phases in which the packet is accepted. The side drops it in any other.

Inherited from ​

InputHandler.phases

Methods ​

handle() ​

handle(packet, context): undefined

Defined in: packages/protocol/src/handler/PacketHandler.ts:60

Applies one input.

Parameters ​
packet ​

P

The decoded packet.

context ​

InputContext

What the side hands an input-lane handler.

Returns ​

undefined

Inherited from ​

InputHandler.handle


ReadLaneHandler ​

Defined in: packages/prismarine/src/player/context/SessionHandler.ts:17

A read-lane handler: it reads the world, writes nothing, and answers only its sender.

Extends ​

Type Parameters ​

P ​

P

Properties ​

lane ​

readonly lane: "read"

Defined in: packages/protocol/src/handler/PacketHandler.ts:41

When the handler runs relative to the world tick.

Inherited from ​

LaneHandler.lane

phases ​

readonly phases: readonly SessionPhase[]

Defined in: packages/protocol/src/handler/PacketHandler.ts:23

The session phases in which the packet is accepted. The side drops it in any other.

Inherited from ​

LaneHandler.phases

Methods ​

handle() ​

handle(packet, context): void | Promise<void>

Defined in: packages/protocol/src/handler/PacketHandler.ts:31

Handles one packet.

Parameters ​
packet ​

P

The decoded packet.

context ​

SessionContext

What the side hands the handler.

Returns ​

void | Promise<void>

Inherited from ​

LaneHandler.handle

Type Aliases ​

SessionHandler ​

SessionHandler<P> = ConnectionLaneHandler<P> | ReadLaneHandler<P> | InputLaneHandler<P>

Defined in: packages/prismarine/src/player/context/SessionHandler.ts:26

Any handler of a player session in the shared shape, its context chosen by its lane.

Type Parameters ​

P ​

P