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)
SourceClass methods
decode_clientbound_packet(packet_bytes : Bytes, protocol_state : ProtocolState, protocol_version : UInt32) : Clientbound::Packet
Protocol-aware packet decoding for clientbound packets
decode_serverbound_packet(packet_bytes : Bytes, protocol_state : ProtocolState, protocol_version : UInt32) : Serverbound::Packet
Protocol-aware packet decoding for serverbound packets
Instance methods
close_reason
Sourceclose_reason=(close_reason : TextComponent | Nil)
Sourceclosed?
Sourcecompression_threshold
Sourcecompression_threshold=(compression_threshold : UInt32)
Sourcedisconnect(reason : String)
Sourcehandler
Sourceio
Sourceio=(io : Minecraft::IO)
Sourceio=(io)
Sourceopen?
Sourceprotocol_state
Sourceprotocol_state=(state : Rosegold::ProtocolState)
Sourceprotocol_version
Sourceread_packet
Sourceread_raw_packet
Sourcesend_packet(packet_bytes : Bytes)
Sourcesend_packet(packet : OutboundPacket)
Source