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:46
🏷️ Properties
compressionThreshold
compressionThreshold: number = -1
Defined in: packages/client/channel.ts:44
connection
connection: Socket = ...
Defined in: packages/client/channel.ts:38
enableCompression
enableCompression: boolean = false
Defined in: packages/client/channel.ts:43
inbound
inbound: Writable
Defined in: packages/client/channel.ts:41
outbound
outbound: Writable
Defined in: packages/client/channel.ts:40
state
state: keyof States = 'handshake'
Defined in: packages/client/channel.ts:21
states
states: Object = ...
Defined in: packages/client/channel.ts:23
🔑 Accessors
ready
Defined in: packages/client/channel.ts:70
🔧 Methods
disconnect
disconnect(): Promise<void>
Return Type
Promise<void>
Defined in: packages/client/channel.ts:122
findCoderById
findCoderById(packetId: number, side: Side): Coder<any>
Parameters
- packetId:
number
- side:
Side
Return Type
Coder<any>
Defined in: packages/client/channel.ts:74
getPacketId
getPacketId(packetInst: any, side: Side): number
Parameters
- packetInst:
any
- side:
Side
Return Type
number
Defined in: packages/client/channel.ts:79
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:103
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:161
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:151
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:162
oncePacket
oncePacket(packet: Function, listener: Function): Channel
Parameters
- packet:
Function
- listener:
Function
Return Type
Channel
Defined in: packages/client/channel.ts:155
registerPacket
registerPacket(entry: PacketRegistryEntry): void
Parameters
- entry:
PacketRegistryEntry
Return Type
void
Defined in: packages/client/channel.ts:93
registerPacketType
registerPacketType(clazz: Function): void
Parameters
- clazz:
Function
Return Type
void
Defined in: packages/client/channel.ts:85
send
send(message: T, skeleton: Partial<T>): void
Sent a packet to server.
Parameters
- message:
T
- skeleton:
Partial<T>
Return Type
void
Defined in: packages/client/channel.ts:141