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
Name | Type | Description |
---|---|---|
message | MessageProtocol | The message received from the server. |
clientInfo | Object | The client information. |
clientInfo.id | string | The client's ID. |
clientInfo.username | string | The 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.