Documentation
¶
Index ¶
- Constants
- type Client
- func (client *Client) Connect() error
- func (client *Client) Disconnect() error
- func (client *Client) IsClientAlive() bool
- func (client *Client) IsConnected() bool
- func (client *Client) ListenToPostgresChanges(opts PostgresChangesOptions, handler func(map[string]any)) error
- func (c *Client) QueryTable(table string, dest any, filters map[string]any) (int, error)
- type ConnectionMsg
- type HearbeatMsg
- type PostgresChangesOptions
- type TemplateMsg
Constants ¶
View Source
const ACCESS_TOKEN_EVENT = "access_token"
View Source
const BROADCAST_EVENT = "broadcast"
Broadcast Events
View Source
const HEARTBEAT_EVENT = "heartbeat"
View Source
const JOIN_EVENT = "phx_join"
Channel Events
View Source
const POSTGRES_CHANGE_EVENT = "postgres_changes"
DB Subscription Events
View Source
const PRESENCE_DIFF_EVENT = "presence_diff"
View Source
const PRESENCE_STATE_EVENT = "presence_state"
Presence Events
View Source
const REPLY_EVENT = "phx_reply"
View Source
const SYS_EVENT = "system"
Other Events
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Url string // WebSocket URL
RestUrl string // REST API URL
ApiKey string
// contains filtered or unexported fields
}
Client is the Supabase Realtime WebSocket client
func CreateRealtimeClient ¶
CreateRealtimeClient initializes a new Client Supports either projectRef or separate host/port/database/user/password params
func (*Client) Disconnect ¶
Disconnect gracefully closes the WebSocket connection
func (*Client) IsClientAlive ¶
isClientAlive checks if client is connected and healthy
func (*Client) IsConnected ¶
IsConnected checks if the client is connected
func (*Client) ListenToPostgresChanges ¶
func (client *Client) ListenToPostgresChanges(opts PostgresChangesOptions, handler func(map[string]any)) error
ListenToPostgresChanges subscribes to changes on a table
type ConnectionMsg ¶
type ConnectionMsg struct {
TemplateMsg
Payload struct {
Data struct {
Schema string `json:"schema"`
Table string `json:"table"`
CommitTime string `json:"commit_timestamp"`
EventType string `json:"eventType"`
New map[string]string `json:"new"`
Old map[string]string `json:"old"`
Errors string `json:"errors"`
} `json:"data"`
} `json:"payload"`
}
type HearbeatMsg ¶
type HearbeatMsg struct {
TemplateMsg
Payload struct {
} `json:"payload"`
}
type PostgresChangesOptions ¶
Postgres subscription support
type TemplateMsg ¶
Click to show internal directories.
Click to hide internal directories.