hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
84 lines (40 loc) • 1.4 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [Player](./server.player.md) > [scheduleNotification](./server.player.schedulenotification.md)
## Player.scheduleNotification() method
Schedules a notification for the player at a future time.
Use for: re-engagement or timed reminders. Do NOT use for: immediate in-game messaging; use chat or UI instead.
**Signature:**
```typescript
scheduleNotification(type: string, scheduledFor: number): Promise<string | void>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
type
</td><td>
string
</td><td>
The type of notification to schedule.
</td></tr>
<tr><td>
scheduledFor
</td><td>
number
</td><td>
A future timestamp in milliseconds to schedule the notification for.
</td></tr>
</tbody></table>
**Returns:**
Promise<string \| void>
The ID of the notification if scheduled successfully, undefined otherwise.
\*\*Requires:\*\* Player must be in a world to request permission.
\*\*Side effects:\*\* Emits `PlayerEvent.REQUEST_NOTIFICATION_PERMISSION`<!-- -->.
\*\*Category:\*\* Players
## Remarks
Automatically prompts for notification permission in-game if needed.