/// /** * @module net */ import { EventEmitter } from 'events'; import { Socket } from 'net'; import { Packet } from './packet'; /** * The configuration for the RC4 ciphers used by this PacketIO. */ export interface RC4Config { incomingKey: string; outgoingKey: string; } /** * A utility class which implements the RotMG messaging protocol on top of a `Socket`. */ export declare class PacketIO extends EventEmitter { /** * The socket this packet interface is attached to. */ socket: Socket; /** * The last packet which was received. */ readonly lastIncomingPacket: Packet; /** * The last packet which was sent. */ readonly lastOutgoingPacket: Packet; private logName; private sendRC4; private receiveRC4; private outgoingQueue; private writer; private reader; private eventHandlers; private _lastIncomingPacket; private _lastOutgoingPacket; /** * Creates a new `PacketIO` on top of the given `socket`. * @param socket The socket to implement the protocol on top of. */ constructor(socket?: Socket, config?: RC4Config); /** * Attaches this Packet IO to the `socket`. * @param socket The socket to attach to. */ attach(socket: Socket): void; /** * Detaches this Packet IO from its `Socket`. */ detach(): void; /** * Sends a packet. * @param packet The packet to send. */ send(packet: Packet): void; private drainQueue; /** * Emits a packet from this PacketIO instance. This will only * emit the packet to the clients subscribed to this particular PacketIO. * @param packet The packet to emit. */ emitPacket(packet: Packet): void; private onConnect; private onData; private constructPacket; private checkBuffer; private resetBuffer; private emitError; } //# sourceMappingURL=packetio.d.ts.map