The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Complete Documentation for subscribe
Angelico5b08a4344f34
diff --git a/web/docs/library/post.mdx b/web/docs/library/post.mdxindex 2ce8c0db5a3..8c6265c17a7 100644--- a/web/docs/library/post.mdx+++ b/web/docs/library/post.mdx@@ -63,7 +63,7 @@ const postUsers = async () => {.post("users",[- { name: "Nelson Bighetti" },+ { fullName: "Nelson Bighetti" },],)return usersdiff --git a/web/docs/library/subscribe.mdx b/web/docs/library/subscribe.mdxindex ddc733c3b9c..1959d4b26f4 100644--- a/web/docs/library/subscribe.mdx+++ b/web/docs/library/subscribe.mdx@@ -55,7 +55,7 @@ or a specific table within that schema. Indicating `"*"` will subscribe the chan```json(event, callback)```-Call a specified `callback` function once a specified event occurs.+Call a specified `callback` function once a specified `event` occurs.### Method arguments#### event@@ -89,6 +89,30 @@ supabase.subscribe("companies").on("INSERT", company => {console.log("New company: ", company)})```+Whenever a new company is inserted into the `companies` table, the client will be notified.+```js+const postCompany = async () => {+ try{+ let company = await supabase+ .post(+ "companies",+ [+ { name: "Raviga Capital Management", employeeCount: 500 }+ ]+ )+ return company+ } catch (error) {+ console.log('Error', error)+ }+}+```+In the example above, once the new company has been inserted into the table, the client+will be provided with this:+```+$ New company: Raviga Capital Management+```++## Responses@@ -109,7 +133,8 @@ const postCompany = async () => {}}```-... will be returned by our listener:++Upon inserting or creating a new row, the following will be returned by our listener:```json{@@ -138,7 +163,7 @@ const updateCompany = async () => {}```-... insert description here+Upon updating a row, the following will be returned by our listener:```json{@@ -165,7 +190,7 @@ const deleteCompany = async () => {}```-... insert description here+Upon deleting a row, the following will be returned by our listener:```json{