Files
supabase/apps/temp-docs/docs/reference/javascript/removesubscription.mdx
2022-04-26 14:17:19 +02:00

90 lines
1.6 KiB
Plaintext

---
id: removesubscription
title: "removeSubscription()"
slug: removesubscription
custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml
---
import Tabs from '@theme/Tabs';
import TabsPanel from '@theme/TabsPanel';
Removes an active subscription and returns the number of open connections.
<Tabs
defaultActiveId="js"
groupId="reference/supabase-js"
values={[{ label: 'JavaScript', value: 'js' }]}>
<TabsPanel id="js" label="js">
```js
supabase.removeSubscription(mySubscription)
```
</TabsPanel>
</Tabs>
## Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
subscription
</span>
<span className="method-list-item-label-badge required">
required
</span>
<span className="method-list-item-validation">
<code>RealtimeSubscription</code>
</span>
</h4>
<div class="method-list-item-description">
The subscription you want to remove.
</div>
</li>
</ul>
## Notes
- Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed.
## Examples
### Remove a subscription
<Tabs
defaultActiveId="js"
groupId="reference/supabase-js"
values={[{ label: 'JavaScript', value: 'js' }]}>
<TabsPanel id="js" label="js">
```js
supabase.removeSubscription(mySubscription)
```
</TabsPanel>
</Tabs>