Supabase.Realtime.Behaviour behaviour (supabase_realtime v0.5.0)

Copy Markdown

Defines the interface for the main module Supabase.Realtime

Summary

Types

channel()

@type channel() :: Supabase.Realtime.Channel.t()

channel_opts()

@type channel_opts() :: keyword()

client()

@type client() :: module() | atom()

event_filter()

@type event_filter() :: Enumerable.t()

event_type()

@type event_type() :: :postgres_changes | :broadcast | :presence

start_option()

@type start_option() :: {:name, atom()} | {:timeout, pos_integer()}

t()

@type t() :: pid() | atom()

Callbacks

broadcast(t, channel, t, map)

@callback broadcast(t(), channel(), String.t(), map()) :: :ok | {:error, term()}

channel(t, t, channel_opts)

@callback channel(t(), String.t(), channel_opts()) :: {:ok, channel()} | {:error, term()}

connection_state(t)

@callback connection_state(t()) :: Supabase.Realtime.connection_state()

on(channel, t, event_filter)

@callback on(channel(), String.t(), event_filter()) :: :ok | {:error, term()}

remove_all_channels(t)

@callback remove_all_channels(t()) :: :ok | {:error, term()}

send(t, channel, map)

@callback send(t(), channel(), map()) :: :ok | {:error, term()}

set_auth(t, t)

@callback set_auth(t(), String.t()) :: :ok | {:error, term()}

set_auth(t, channel, t)

@callback set_auth(t(), channel(), String.t()) :: :ok | {:error, term()}

start_link(t, list)

@callback start_link(Supabase.Client.t(), [start_option()]) :: Supervisor.on_start()

track(t, channel, map)

@callback track(t(), channel(), map()) :: :ok | {:error, term()}

unsubscribe(channel)

@callback unsubscribe(channel()) :: :ok | {:error, term()}

untrack(t, channel)

@callback untrack(t(), channel()) :: :ok | {:error, term()}