res://addons/w4gd/supabase/realtime.gd

Inherits: RefCounted

Client for the Supabase realtime API.

Methods

res://addons/w4gd/supabase/realtime.gd:Subscription

channel ( String p_channel, Dictionary p_config )

void

connect_socket ( )

void

disconnect_socket ( bool p_clear )

void

poll ( )


Signals

connection_closed ( )

Emitted after our connection to Supabase realtime has closed.


connection_error ( )

Emitted after there's been an error connecting to Supabase realtime.


connection_succeded ( )

Emitted after we've successfully connected to Supabase realtime.


Enumerations

enum SendEvent:

SendEvent REPLY = 0

SendEvent CLOSE = 1

SendEvent ERROR = 2

SendEvent JOIN = 3

SendEvent LEAVE = 4

SendEvent HEARTBEAT = 5


enum RecvEvent:

RecvEvent REPLY = 0

RecvEvent CLOSE = 1

RecvEvent SYSTEM = 2

RecvEvent INSERT = 3

RecvEvent UPDATE = 4

RecvEvent DELETE = 5

RecvEvent BROADCAST = 6

RecvEvent PRESENCE_STATE = 7

RecvEvent PRESENCE_DIFF = 8

RecvEvent POSTGRES_CHANGES = 9


Constants

_SEND_EVENT_NAMES = { 0: "phx_reply", 1: "phx_close", 2: "phx_error", 3: "phx_join", 4: "phx_leave", 5: "heartbeat" }

According to Phoenix realtime server specifications.

_REPLY_EVENT_NAME_MAP = { "phx_reply": 0, "phx_close": 1, "system": 2, "INSERT": 3, "UPDATE": 4, "DELETE": 5, "broadcast": 6, "presence_state": 7, "presence_diff": 8, "postgres_changes": 9 }

_PHOENIX_CHANNEL = phoenix

_HEARTBEAT_TIME = 5000


Method Descriptions

res://addons/w4gd/supabase/realtime.gd:Subscription channel ( String p_channel, Dictionary p_config )

Creates a Subscription object for the given channel. You must call res://addons/w4gd/supabase/realtime.gd:Subscription.subscribe in order to actually subscribe. Here's some examples of p_config: - Postgres changes: { postgres_changes = [{ event = '...', schema = '...', table = '...', filter = '...'}]} - Self-send broadcast messages or receive acknowledgements: { broadcast = { 'self': true, 'ack': true }} - Change presence key: { presence = { key = 'userId-1' }} This can all be combined if necessary.


void connect_socket ( )

Connect to Supabase realtime via WebSockets.


void disconnect_socket ( bool p_clear )

Disconnect from WebSocket to Supabase realtime.


void poll ( )

Polls the WebSocket to receive new data. This should be called automatically every frame.