class

Rosegold::Connection(InboundPacket, OutboundPacket)

Inherits Reference / Object

Something that packets can be read from and sent to. Can be used for client and server. Caller of #read_packet must update #state= appropriately. Useless after disconnect; create a new instance to reconnect.

Constructors

new(io : Minecraft::IO, protocol_state : Rosegold::ProtocolState, protocol_version : UInt32, handler : Rosegold::EventEmitter | Nil = nil)
Source

Class methods

decode_clientbound_packet(packet_bytes : Bytes, protocol_state : ProtocolState, protocol_version : UInt32) : Clientbound::Packet

Protocol-aware packet decoding for clientbound packets

Source
decode_serverbound_packet(packet_bytes : Bytes, protocol_state : ProtocolState, protocol_version : UInt32) : Serverbound::Packet

Protocol-aware packet decoding for serverbound packets

Source

Instance methods

close_reason
Source
close_reason=(close_reason : TextComponent | Nil)
Source
closed?
Source
compression_threshold
Source
compression_threshold=(compression_threshold : UInt32)
Source
disconnect(reason : String)
Source
handler
Source
handler=(handler : Rosegold::EventEmitter | Nil)
Source
io=(io)
Source
open?
Source
protocol_state
Source
protocol_state=(state : Rosegold::ProtocolState)
Source
protocol_version
Source
read_packet
Source
read_raw_packet
Source
send_packet(packet_bytes : Bytes)
Source
send_packet(packet : OutboundPacket)
Source

Nested types