Skip to main content

Interface: NetIntercept

An interceptor for the network layer. When registered to a network instance, the network instance will run through all network packets through the interceptor, and also allowing the interceptor to send packets to the server.

Implemented by

Properties

onMessage

Optional onMessage: (message: MessageProtocol, clientInfo: { id: string ; username: string }) => void

Type declaration

▸ (message, clientInfo): void

A listener to be implemented to handle incoming packets.

Parameters
NameTypeDescription
messageMessageProtocolThe message received from the server.
clientInfoObjectThe client information.
clientInfo.idstringThe client's ID.
clientInfo.usernamestringThe client's username.
Returns

void


packets

Optional packets: MessageProtocol[]

An array of packets to be sent to the server. These packets will be sent to the server after every network.flush() call.