class Rosegold::Connection(InboundPacket, OutboundPacket)

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.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(io : Minecraft::IO, state : Hash(UInt8, InboundPacket.class), handler : Rosegold::EventEmitter | Nil = nil) #

[View source]

Class Method Detail

def self.decode_packet(packet_bytes : Bytes, state : Hash(UInt8, InboundPacket.class)) : InboundPacket #

[View source]

Instance Method Detail

def close_reason : Chat | Nil #

[View source]
def close_reason=(close_reason : Chat | Nil) #

[View source]
def closed? #

[View source]
def compression_threshold : UInt32 #

[View source]
def compression_threshold=(compression_threshold : UInt32) #

[View source]
def disconnect(reason : Chat) #

[View source]
def handler : Rosegold::EventEmitter | Nil #

[View source]
def handler=(handler : Rosegold::EventEmitter | Nil) #

[View source]
def io : Minecraft::IO #

[View source]
def io=(io : Minecraft::IO) #

[View source]
def io=(io) #

[View source]
def open? #

[View source]
def read_packet : InboundPacket #

[View source]
def read_raw_packet : Bytes #

[View source]
def send_packet(packet_bytes : Bytes) #

[View source]
def send_packet(packet : OutboundPacket) #

[View source]
def state : Hash(UInt8, InboundPacket.class) #

[View source]
def state=(state : Hash(UInt8, InboundPacket.class)) #

[View source]