The port number to bind to
OptionalincomingBandwidthLimit: null | numberOptionaloutgoingBandwidthLimit: null | numberOptionalenableCompressor: null | booleanOptionalenableChecksum: null | booleanOptionalseed: null | numberRandom number generator seed, or null for random seed
Get the maximum allowed channels for future incoming connections.
The channel limit
Get the IP address of the host socket.
The IP address as a string
The maximum transmission unit (MTU), or the maximum packet size that will be sent by this host.
The MTU value
Get the maximum number of peers that can connect to this host.
The peer limit
Get the port number of the host socket.
The port number
Queues a packet to be sent to all connected peers.
The packet data to broadcast
True on success
Checks for any queued events on the host.
True if there are queued events, false otherwise
Initiates a connection to a foreign host.
The port number of the remote host
True if connection initiated successfully, false otherwise
Sends any queued packets on the host to its designated peers.
True on success
Get the host's current bandwidth limits.
Object with optional 'incoming' and 'outgoing' properties (bytes/second), undefined if no limit
Get a snapshot of peer data by peer ID. Returns a NativePeer object containing current state and statistics.
NativePeer snapshot containing peer data
Get the current time according to this host.
Time in milliseconds since epoch
Get the number of connected peers.
The count of currently connected peers
Adjusts the bandwidth limits of the host in bytes/second. ENet will strategically drop packets to ensure bandwidth is not overwhelmed. The bandwidth parameters also determine the window size which limits reliable packets in transit.
Optionalincoming: null | numberDownstream bandwidth limit in bytes/second, or null for no limit (cannot be 0)
Optionaloutgoing: null | numberUpstream bandwidth limit in bytes/second, or null for no limit (cannot be 0)
True on success
Set the event emitter callback function. This callback will be invoked during service() calls when events occur.
The callback function to handle events (connect, raw, disconnect)
Creates a new ENet host for communicating with peers.