The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Moves the protocol to the reference docs
Copple962a869786d7
diff --git a/apps/docs/docs/guides/realtime/protocol.mdx b/apps/docs/docs/guides/realtime/protocol.mdxdeleted file mode 100644index 7818171a8d1..00000000000--- a/apps/docs/docs/guides/realtime/protocol.mdx+++ /dev/null@@ -1,107 +0,0 @@-----id: protocol-title: Realtime Protocol-description: Understanding Realtime Protocol-sidebar_label: Protocol-------## Connection--In the initial message, the client sends the server a configuration of features that wants to use.--```json-{- "topic":$TOPIC,- "event":"phx_join",- "payload":{- "config":{- "broadcast":{- "self":true- },- "presence":{- "key":""- },- "postgres_changes":[- {- "event":$EVENT,- "schema":$SCHEMA,- "table":$TABLE,- "filter":$FILTER- }- ]- }- },- "ref":$REF_NUMBER-}-```--In response, the server sends the Postgres CDC configuration with a unique id. By this id, the client should route incoming changes to the appropriate callback.--```json-{- "event":"phx_reply",- "payload":{- "response":{- "postgres_changes":[- {- "id":13399220,- "event":"*",- "filter":$FILTER,- "schema":$SCHEMA,- "table":$TABLE- }- ]- },- "status":"ok"- },- "ref":$REF_NUMBER,- "topic":$TOPIC-}-```--## System message--Currently, a system message uses only to inform about the status of the Postgres CDC subscription. The `payload.status` indicates if the subscription success or not. The body of the `payload.message` can be "Subscribed to PostgreSQL" or "Subscribing to PostgreSQL failed" with subscription params.--```json-{- "event":"system",- "payload":{- "channel":"any",- "extension":"postgres_changes",- "message":$MESSAGE,- "status":"ok" | "error"- },- "ref":null,- "topic":$TOPIC-}-```--## Heartbeat--The heartbeat message should be sent every 60 seconds to avoid a connection timeout.--```json-{- "topic":"phoenix",- "event":"heartbeat",- "payload":{},- "ref":$REF_NUMBER-}-```--## Access Token--To update the access token need to send to the server the following message and specify a new token in the `payload.access_token` value.--```json-{- "topic":$TOPIC,- "event":"access_token",- "payload":{- "access_token":$NEW_JWT_TOKEN- },- "ref":$REF_NUMBER-}-```diff --git a/apps/docs/docs/reference/javascript/protocol.mdx b/apps/docs/docs/reference/javascript/protocol.mdxnew file mode 100644index 00000000000..bb61b86b9eb--- /dev/null+++ b/apps/docs/docs/reference/javascript/protocol.mdx@@ -0,0 +1,109 @@+---+id: protocol+title: Realtime Protocol+description: Understanding Realtime Protocol+sidebar_label: Protocol+---++The Realtime Protocal is a set of message formats that you send and receive from the Realtime server.++## Connection++In the initial message, the client sends a message specifying the features that wants to use (Broadcase, Presence, Postgres Changes).++```json+{+ "event": "phx_join",+ "topic": $TOPIC,+ "payload": {+ "config": {+ "broadcast": {+ "self": true+ },+ "presence": {+ "key": ""+ },+ "postgres_changes": [+ {+ "event": $EVENT,+ "schema": $SCHEMA,+ "table": $TABLE,+ "filter": $FILTER+ }+ ]+ }+ },+ "ref": $REF_NUMBER+}+```++In response, the server sends the Postgres configuration with a unique ID. With this ID, the client should route incoming changes to the appropriate callback.++```json+{+ "event": "phx_reply",+ "payload": {+ "response": {+ "postgres_changes": [+ {+ "id": 13399220,+ "event": "*",+ "filter": $FILTER,+ "schema": $SCHEMA,+ "table": $TABLE+ }+ ]+ },+ "status": "ok"+ },+ "ref": $REF_NUMBER,+ "topic": $TOPIC+}+```++## System messages++System message are used to inform a client about the status of the Postgres subscription. The `payload.status` indicates if the subscription successful or not.+The body of the `payload.message` can be "Subscribed to PostgreSQL" or "Subscribing to PostgreSQL failed" with subscription params.++```json+{+ "event": "system",+ "payload":{+ "channel": "any",+ "extension": "postgres_changes",+ "message": $MESSAGE,+ "status": "ok" | "error"+ },+ "ref":null,+ "topic": $TOPIC+}+```++## Heartbeat++The heartbeat message should be sent every 60 seconds to avoid a connection timeout.++```json+{+ "topic": "phoenix",+ "event": "heartbeat",+ "payload": {},+ "ref": $REF_NUMBER+}+```++## Access Token++To update the access token, you need to send to the server a message specifying a new token in the `payload.access_token` value.++```json+{+ "topic": $TOPIC,+ "event": "access_token",+ "payload":{+ "access_token": $NEW_JWT_TOKEN+ },+ "ref": $REF_NUMBER+}+```diff --git a/apps/reference/nav/supabase_js_sidebars.js b/apps/reference/nav/supabase_js_sidebars.jsindex fc07909a7c7..539836cfd69 100644--- a/apps/reference/nav/supabase_js_sidebars.js+++ b/apps/reference/nav/supabase_js_sidebars.js@@ -25,6 +25,7 @@ const sidebars = {'installing','generated/initializing','typescript-support',+ 'protocol','release-notes','upgrade-guide',],