# enet_peer

### send(data) <sub>function</sub>


Send a JavaScript object to this peer on channel 0. The object is serialized to JSON and
sent reliably. Throws an error if serialization fails.



**data**: A JavaScript object to send.


**Returns**: None


### disconnect() <sub>function</sub>


Request a graceful disconnection from this peer. The connection will close after
pending data is sent.



**Returns**: None


### disconnect_now() <sub>function</sub>


Immediately terminate the connection to this peer, discarding any pending data.



**Returns**: None


### disconnect_later() <sub>function</sub>


Request a disconnection from this peer after all queued packets are sent.



**Returns**: None


### reset() <sub>function</sub>


Reset this peer's connection, immediately dropping it and clearing its internal state.



**Returns**: None


### ping() <sub>function</sub>


Send a ping request to this peer to measure latency.



**Returns**: None


### throttle_configure(interval, acceleration, deceleration) <sub>function</sub>


Configure the throttling behavior for this peer, controlling how ENet adjusts its sending
rate based on packet loss or congestion.



**interval**: The interval (ms) between throttle adjustments.

**acceleration**: The factor to increase sending speed when conditions improve.

**deceleration**: The factor to decrease sending speed when conditions worsen.


**Returns**: None


### timeout(timeout_limit, timeout_min, timeout_max) <sub>function</sub>


Set timeout parameters for this peer, determining how long ENet waits before considering
the connection lost.



**timeout_limit**: The total time (ms) before the peer is disconnected.

**timeout_min**: The minimum timeout (ms) used for each timeout attempt.

**timeout_max**: The maximum timeout (ms) used for each timeout attempt.


**Returns**: None

