puter.peer.ensureTurnRelays() Fetches TURN relay credentials ahead of time so that peer connections can start faster.
Calling it is optional, because puter.peer.serve() and puter.peer.connect() call it automatically when needed.
await puter.peer.ensureTurnRelays();
await puter.peer.ensureTurnRelays(options);
options (Object) (optional)
An object with the following properties:
| Option | Type | Description |
|---|---|---|
turnGrant |
String |
A grant from puter.peer.createGuestGrant(), to preload relays as a guest with no Puter session. Credentials are minted against the account that issued the grant. |
A Promise that resolves when relay details are cached. If relays cannot be loaded, Puter.js will fall back to default ICE servers when connecting.