<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md) &gt; [onData](./client.hytopiaui.ondata.md)

## HytopiaUI.onData() method

Registers a listener for data received by the server from `player.ui.sendData()`<!-- -->.

**Signature:**

```typescript
onData(callback: (data: object) => void): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

callback


</td><td>

(data: object) =&gt; void


</td><td>

Function to call when data is received from the server.


</td></tr>
</tbody></table>

**Returns:**

void

