class Rosegold::Connection(InboundPacket, OutboundPacket)
- Rosegold::Connection(InboundPacket, OutboundPacket)
- Reference
- Object
Overview
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.
Defined in:
rosegold/packets/connection.crConstructors
Class Method Summary
Instance Method Summary
- #close_reason : Chat | Nil
- #close_reason=(close_reason : Chat | Nil)
- #closed?
- #compression_threshold : UInt32
- #compression_threshold=(compression_threshold : UInt32)
- #disconnect(reason : Chat)
- #handler : Rosegold::EventEmitter | Nil
- #handler=(handler : Rosegold::EventEmitter | Nil)
- #io : Minecraft::IO
- #io=(io : Minecraft::IO)
- #io=(io)
- #open?
- #read_packet : InboundPacket
- #read_raw_packet : Bytes
- #send_packet(packet_bytes : Bytes)
- #send_packet(packet : OutboundPacket)
- #state : Hash(UInt8, InboundPacket.class)
- #state=(state : Hash(UInt8, InboundPacket.class))
Constructor Detail
def self.new(io : Minecraft::IO, state : Hash(UInt8, InboundPacket.class), handler : Rosegold::EventEmitter | Nil = nil)
#
Class Method Detail
def self.decode_packet(packet_bytes : Bytes, state : Hash(UInt8, InboundPacket.class)) : InboundPacket
#