import { Connection } from "https://deno.land/x/minecraft_lib@0.1.0/network/mod.ts";
Represets the client or server end of a connection.
It handles packet framing, compression, encryption, and serialization of packets when a protocol is specified.
Constructors
Methods
Closes the underlying Deno.Conn
and calls PacketHandler.onDisconnect
on the packet handler, if specified with the protocol.
Receives and deserializes a packet using the previously specified protocol.
When a packet handler is specified with the protocol, the
Packet.handle
method will be called.
If no protocol is set, this method will throw an exception.
Once there are no more packets to read, e.g. because the connection has
been closed, this method returns a null
value.
Sends a packet and serializes it using the previously specified protocol.
If no protocol is set, this method will throw an exception.
Sets the server protocol, optionally specifying a packet handler.
Sets the compression threshold value. Negative values disable compression.
If the value is set to a non-negative number, the packet format is changed and all packets larger than the threshold in bytes are compressed.
Enables encryption on the connection and initializes the cipher with the specified key.
Sets the client protocol, optionally specifying a packet handler.