voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
31 lines (17 loc) • 1.34 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/database](./database.md) > [goOffline](./database.gooffline.md)
## goOffline() function
Disconnects from the server (all Database operations will be completed offline).
The client automatically maintains a persistent connection to the Database server, which will remain active indefinitely and reconnect when disconnected. However, the `goOffline()` and `goOnline()` methods may be used to control the client connection in cases where a persistent connection is undesirable.
While offline, the client will no longer receive data updates from the Database. However, all Database operations performed locally will continue to immediately fire events, allowing your application to continue behaving normally. Additionally, each operation performed locally will automatically be queued and retried upon reconnection to the Database server.
To reconnect to the Database and begin receiving remote events, see `goOnline()`<!-- -->.
<b>Signature:</b>
```typescript
export declare function goOffline(db: FirebaseDatabase): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| db | [FirebaseDatabase](./database.firebasedatabase.md) | The instance to disconnect. |
<b>Returns:</b>
void