Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: add Supabase client removeAllSubscriptions()

Wen Bo Xie799ff0fc2d8b
diff --git a/web/sidebar_spec_cli.js b/web/sidebar_spec_cli.js
index 6e68c9dad61..5fa5724ce5f 100644
--- a/web/sidebar_spec_cli.js
+++ b/web/sidebar_spec_cli.js
@@ -3,13 +3,19 @@ module.exports = {
{
type: 'category',
label: 'About',
- items: ['reference/cli/index', 'reference/cli/supabase-init'],
+ items: ['reference/cli/index'],
collapsed: true,
},
{
type: 'category',
- label: 'Local Development',
- items: ['reference/cli/supabase-start', 'reference/cli/supabase-stop', 'reference/cli/supabase-eject'],
+ label: 'Command reference',
+ items: ['reference/cli/supabase-help', 'reference/cli/supabase-init', 'reference/cli/supabase-start', 'reference/cli/supabase-db-branch-list', 'reference/cli/supabase-db-branch-create', 'reference/cli/supabase-db-branch-delete', 'reference/cli/supabase-db-switch', 'reference/cli/supabase-db-changes', 'reference/cli/supabase-db-commit', 'reference/cli/supabase-db-reset', 'reference/cli/supabase-db-remote-set', 'reference/cli/supabase-db-remote-commit', 'reference/cli/supabase-db-push', 'reference/cli/supabase-migration-new'],
+ collapsed: true,
+ },
+ {
+ type: 'category',
+ label: 'Config reference',
+ items: ['reference/cli/config-reference'],
collapsed: true,
}
],
diff --git a/web/sidebar_spec_supabase.js b/web/sidebar_spec_supabase.js
index 45cf77eb4fc..20e1d9bed38 100644
--- a/web/sidebar_spec_supabase.js
+++ b/web/sidebar_spec_supabase.js
@@ -27,7 +27,7 @@ module.exports = {
{
type: 'category',
label: 'Realtime',
- items: ['reference/javascript/subscribe', 'reference/javascript/removesubscription', 'reference/javascript/getsubscriptions'],
+ items: ['reference/javascript/subscribe', 'reference/javascript/removesubscription', 'reference/javascript/removeallsubscriptions', 'reference/javascript/getsubscriptions'],
collapsed: true,
},
{
diff --git a/web/spec/combined.json b/web/spec/combined.json
index 6649472728e..1a0ac34543c 100644
--- a/web/spec/combined.json
+++ b/web/spec/combined.json
@@ -1210,6 +1210,46 @@
}
]
},
+ {
+ "id": 336,
+ "name": "removeAllSubscriptions",
+ "kind": 2048,
+ "kindString": "Method",
+ "flags": {
+ "isExported": true
+ },
+ "signatures": [
+ {
+ "id": 337,
+ "name": "removeAllSubscriptions",
+ "kind": 4096,
+ "kindString": "Call signature",
+ "flags": {
+ "isExported": true
+ },
+ "comment": {
+ "shortText": "Removes all subscriptions and disconnects the Websocket connection."
+ },
+ "type": {
+ "type": "reference",
+ "typeArguments": [
+ {
+ "type": "intrinsic",
+ "name": "unknown"
+ }
+ ],
+ "name": "Promise"
+ }
+ }
+ ],
+ "sources": [
+ {
+ "fileName": "src/SupabaseClient.ts",
+ "line": 129,
+ "character": 20
+ }
+ ]
+ },
{
"id": 324,
"name": "rpc",
diff --git a/web/spec/supabase.json b/web/spec/supabase.json
index cbd90d17748..cc3175a1dfa 100644
--- a/web/spec/supabase.json
+++ b/web/spec/supabase.json
@@ -1207,6 +1207,46 @@
}
]
},
+ {
+ "id": 336,
+ "name": "removeAllSubscriptions",
+ "kind": 2048,
+ "kindString": "Method",
+ "flags": {
+ "isExported": true
+ },
+ "signatures": [
+ {
+ "id": 337,
+ "name": "removeAllSubscriptions",
+ "kind": 4096,
+ "kindString": "Call signature",
+ "flags": {
+ "isExported": true
+ },
+ "comment": {
+ "shortText": "Removes all subscriptions and disconnects the Websocket connection."
+ },
+ "type": {
+ "type": "reference",
+ "typeArguments": [
+ {
+ "type": "intrinsic",
+ "name": "unknown"
+ }
+ ],
+ "name": "Promise"
+ }
+ }
+ ],
+ "sources": [
+ {
+ "fileName": "src/SupabaseClient.ts",
+ "line": 129,
+ "character": 20
+ }
+ ]
+ },
{
"id": 324,
"name": "rpc",
diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml
index b36daeb5d01..62f074323eb 100644
--- a/web/spec/supabase.yml
+++ b/web/spec/supabase.yml
@@ -150,6 +150,7 @@ info:
items:
- subscribe()
- removeSubscription()
+ - removeAllSubscriptions()
- getSubscriptions()
- name: 'Storage'
items:
@@ -1274,6 +1275,19 @@ pages:
supabase.removeSubscription(mySubscription)
```
+ removeAllSubscriptions():
+ title: 'removeAllSubscriptions()'
+ $ref: '@supabase/supabase-js."SupabaseClient".SupabaseClient.removeAllSubscriptions'
+ 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:
+ - name: Removes all subscriptions
+ isSpotlight: true
+ js: |
+ ```js
+ supabase.removeAllSubscriptions()
+ ```
+
getSubscriptions():
title: 'getSubscriptions()'
$ref: '@supabase/supabase-js."SupabaseClient".SupabaseClient.getSubscriptions'