Class Channel
The channel for send and listen the Minecraft packet.
🏭 Constructors
constructor
new Channel(): Channel
Return Type
Channel
Defined in: packages/client/channel.ts:47
🏷️ Properties
compressionThreshold private
compressionThreshold: number = -1
Defined in: packages/client/channel.ts:45
connection private
connection: Socket = ...
Defined in: packages/client/channel.ts:38
enableCompression private
enableCompression: boolean = false
Defined in: packages/client/channel.ts:44
inbound private
inbound: Writable
Defined in: packages/client/channel.ts:41
listened private
listened: boolean = false
Defined in: packages/client/channel.ts:42
outbound private
outbound: Writable
Defined in: packages/client/channel.ts:40
state
state: keyof States = 'handshake'
Defined in: packages/client/channel.ts:21
states private readonly
states: Object = ...
Defined in: packages/client/channel.ts:23
🔑 Accessors
ready
Defined in: packages/client/channel.ts:71
🔧 Methods
disconnect
disconnect(): Promise<void>
Return Type
Promise<void>
Defined in: packages/client/channel.ts:124
findCoderById
findCoderById(packetId: number, side: Side): Coder<any>
Parameters
- packetId:
number
- side:
Side
Return Type
Coder<any>
Defined in: packages/client/channel.ts:75
getPacketId
getPacketId(packetInst: any, side: Side): number
Parameters
- packetInst:
any
- side:
Side
Return Type
number
Defined in: packages/client/channel.ts:80
listen
listen(option: Object): Promise<void>
Open the connection and start to listen the port.
Parameters
- option:
Object
Return Type
Promise<void>
Defined in: packages/client/channel.ts:104
on
on(channel: string, listener: Function): Channel
Parameters
- channel:
string
- listener:
Function
Return Type
Channel
Inherited from: EventEmitter.on
Defined in: packages/client/channel.ts:172
onPacket
onPacket(packet: Function, listener: Function): Channel
Listen for sepcific packet by its class name.
Parameters
- packet:
Function
- listener:
Function
Return Type
Channel
Defined in: packages/client/channel.ts:162
once
once(channel: string, listener: Function): Channel
Parameters
- channel:
string
- listener:
Function
Return Type
Channel
Inherited from: EventEmitter.once
Defined in: packages/client/channel.ts:173
oncePacket
oncePacket(packet: Function, listener: Function): Channel
Parameters
- packet:
Function
- listener:
Function
Return Type
Channel
Defined in: packages/client/channel.ts:166
registerPacket
registerPacket(entry: PacketRegistryEntry): void
Parameters
- entry:
PacketRegistryEntry
Return Type
void
Defined in: packages/client/channel.ts:94
registerPacketType
registerPacketType(clazz: Function): void
Parameters
- clazz:
Function
Return Type
void
Defined in: packages/client/channel.ts:86
send
send(message: T, skeleton: Partial<T>): Promise<void>
Sent a packet to server.
Parameters
- message:
T
- skeleton:
Partial<T>
Return Type
Promise<void>
Defined in: packages/client/channel.ts:144