import { Transmitter } from "https://deno.land/x/sockets@v0.5.0/mod.ts";
The Transmitter
class is used as the middleman between the client and
server, when sending messages, to connect the 'wires' between them.
Constructors
new
Transmitter(server: Server, options?: ITransmitterOptions)Construct an object of this class.
Properties
private
server: ServerA property to hold the socket server.
Methods
private
ping(clientId: number): voidPings client at a set interval.
private
startHeartbeat(clientId: number): numberStart a heartbeat for the client in question.
private
timeoutPing(clientId: number): voidPings client at a timeout. If client does not respond, client connection will be removed.
handlePacket(packet: Packet): Promise<void>
Decodes and validates incoming messages.
handleReservedEvent(packet: Packet): void
Handles connection states, and actions based on those states.
hydrateClient(clientId: number): void
Hydrate the client with properties.