Supabase.Realtime Options self option enables client to receive message it broadcast ack option instructs server to acknowledge that broadcast message was received Initializes broadcast options Channel Options A function that returns the current access token. Parameters that are sent to the channel when opened (JSON Serializable) The Client Options The Serializer Settings The Channel Options (typically only called from within the ) Class representation of a single request sent to the Socket server. `Push` also adds additional functionality for retrying, timeouts, and listeners for its associated response from the server. Flag representing the `sent` state of a request. Invoked when this `Push` has not been responded to within the timeout interval. Accessor for the returned Socket Response The associated channel. The event requested. Payload of data to be sent. Represents the Pushed (sent) Message Ref Of this Message Handlers for notifications of message events. Initializes a single request that will be `Pushed` to the Socket server. Resends a `Push` request. Sends a `Push` request and initializes the Timeout. Keeps an internal timer for raising an event if this message is not responded to. Handles when a socket message is received for this push. Adds a listener to be notified when a message is received. Removes a specified listener from messages received. Notifies all listeners that the socket has received a message Clears all of the listeners from receiving event state changes. Singleton that represents a Client connection to a Realtime Server. It maintains a singular Websocket with asynchronous listeners (RealtimeChannels). client = Client.Instance Exposes all Realtime RealtimeChannel Subscriptions for R/O public consumption The backing Socket class. Most methods of the Client act as proxies to the Socket class. Client Options - most of which are regarding Socket connection Options Custom Serializer resolvers and converters that will be used for encoding and decoding Postgrest JSON responses. By default, Postgrest seems to use a date format that C# and Newtonsoft do not like, so this initial configuration handles that. JWT Access token for WALRUS security Handlers for notifications of state changes. Initializes a Client instance, this method should be called prior to any other method. The connection url (ex: "ws://localhost:4000/socket" - no trailing slash required) Client Attempts to connect to the Socket. Returns when socket has successfully connected. Attempts to connect to the socket. Provides a callback for `Task` driven returns. Adds a listener to be notified when the socket state changes. Removes a specified listener from socket state changes. Clears all of the listeners from receiving socket state changes. Notifies all listeners that the current user auth state has changed. This is mainly used internally to fire notifications - most client applications won't need this. Adds a debug handler, likely used within a logging solution of some kind. Removes a debug handler Clears debug handlers; Sets the current Access Token every heartbeat (see: https://github.com/supabase/realtime-js/blob/59bd47956ebe4e23b3e1a6c07f5fe2cfe943e8ad/src/RealtimeClient.ts#L437) Disconnects from the socket server (if connected). Status Code Reason for disconnect Sets the JWT access token used for channel subscription authorization and Realtime RLS. Ref: https://github.com/supabase/realtime-js/pull/117 | https://github.com/supabase/realtime-js/pull/117 Adds a RealtimeChannel subscription - if a subscription exists with the same signature, the existing subscription will be returned. The name of the Channel to join (totally arbitrary) Adds a RealtimeChannel subscription - if a subscription exists with the same signature, the existing subscription will be returned. Database to connect to, with Supabase this will likely be `realtime`. Postgres schema, usually `public` Postgres table name Postgres column name Value the specified column should have Removes a channel subscription. The default socket message encoder, used to serialize messages to the socket server. It is unlikely that this will be overriden by the developer. The default socket message decoder, used to deserialize messages from the socket server. Ref: It is unlikely that this will be overriden by the developer. Options used when initializing a The function to encode outgoing messages. Defaults to JSON The function to decode incoming messages. The Websocket Transport, for example WebSocket. The default timeout in milliseconds to trigger push timeouts. @todo Presently unused: Limit the number of events that can be sent per second. The interval to send a heartbeat message The interval to reconnect Request headers to be appended to the connection string. The optional params to pass when connecting Datetime Style for JSON Deserialization of Models Datetime format for JSON Deserialization of Models (Postgrest style) Shared constants for Realtime The Current Socket state, used in Socket Open Socket Closed Socket is Reconnecting Socket has errored Mapping of channel states, used with Channel is closed Channel has errored Channel is joined Channel is joining Channel is leaving A channel event type used and parsed in a postgres_changes `Insert` event postgres_changes `Update` event postgres_changes `Delete` event A broadcast event A presence `state` or `sync` event A presence `leave` or `join` event The catchall event for `postgres_changes`, parsed into a more specific `Insert`, `Update` or `Delete` A system event (likely unused by the developer) An internal event (likely unused by the developer) A presently unknown event, if this is seen, please open an issue at https://github.com/supabase-community/realtime-csharp Map of Presence listener types, used with: A sync event (either join or leave) A join event A leave event Mapping for event names that can be used with to send arbitrary data. This is unlikely to be used by the developer. The broadcast event The Presence event A postgres_changes event Timeout interval for requests (used in Socket and Push) Phoenix Socket Server Event: CLOSE Phoenix Socket Server Event: ERROR Phoenix Socket Server Event: JOIN Phoenix Socket Server Event: REPLY Phoenix Socket Server Event: SYSTEM Phoenix Socket Server Event: LEAVE Phoenix Server Event: OK Phoenix Server Event: POSTGRES_CHANGES Phoenix Server Event: BROADCAST Phoenix Server Event: PRESENCE_STATE Phoenix Server Event: PRESENCE_DIFF Phoenix Server Event: ERROR The transport type, used with Phoenix server implementations and appended on the The event name used to send an access_token to the Phoenix server An int array converter that specifically parses Postgrest styled arrays `{1,2,3}` and `[1,2,3]` from strings into a . An string array converter that specifically parses Postgrest styled arrays `{big,string,array}` and `[1,2,3]` from strings into a . A custom resolver that handles mapping column names and property names as well as handling the conversion of Postgrest Ranges to a C# `Range`. A Singleton used for debug notifications Returns the Singleton Instance. Adds a debug listener Removes a debug handler. Clears debug handlers. Notifies debug listeners. A failure hint Reasons for a failure Catchall for any kind of failure that is presently untyped. A push timeout Channel is not open Channel cannot be joined Socket has errored, either in connection or reconnection. Connection has been lost No message has been received, usually given by server. If seen, please open an issue. Parses a Failure reason from a An Exception thrown within A specific reason for this exception, as provided by this library. Creates exception from a instance. A contract representing a realtime broadcast A delegate for broadcast events Adds a broadcast event handler Removes a broadcast event handler Clears all broadcast event handlers Sends a broadcast to a given event name with an arbitrary, serializable payload. An internal trigger used for notifying event delegates. A contract representing a realtime channel Delegate for messages received on this channel Delegate for channel state changes Delegate for postgres changes Delegate for errors on this channel If this channel has been successfully joined (and thus, should be rejoined on a failure) Is channel closed? Is channel erroring? Is channel joined? Is channel being joined? Is channel leaving? The Channel's initialization options The Channel's broadcast options (used prior to ) The Channel's presence options (used prior to ) The Channel's postgres_changes options (used prior to ) The Channel's current state A string representing this channel's topic, used for identifying/repeat access to this channel. Add a state changed listener Remove a state changed handler Clear state changed handlers Add a message received handler Remove a message received handler. Clear message received handlers. Add a postgres_changes handler Remove a postgres_changes handler Clear postgres_changes handlers Add an error handler Remove an error handler Clear error handlers. Get the helper Get the helper. Push an arbitrary event to a subscribed channel. Rejoin a channel. Send an arbitrary event with an awaitable task. Register broadcast options, must be called to use , and prior to Register presence options, must be called to use , and prior to Register postgres_changes options, must be called to use , and prior to Subscribes to a channel. Unsubscribes from a channel. Contract representing a Realtime Client The options initializing this client. Json serializer settings The connected realtime socket A collection of channels ordered by topic name Delegate for handling a socket state event, this can be seen as synonymous with the Client's state. Add a Socket State listener Remove a Socket State listener Clear socket state listeners Adds a debug handler, likely used within a logging solution of some kind. Removes a debug handler Clears debug handlers; Initialize a new channel with an arbitrary channel name. Shorthand initialization of a channel with postgres_changes options already set. Connect to the Connect to the Disconnect from the Remove an initialized Sets the authentication JWT to be passed into all realtime channels. Used for WALRUS permissions. Contract representing an internal debugger. A debug event handler Adds a debug listener Removes a debug handler. Clears debug handlers. Notifies debug listeners Contract representing a Realtime Presence class Delegate for a presence event. Mapping of presence event types Sync event (both join and leave) Join event Leave event Send an arbitrary payload as a presence event, MUST be called once to register this client as an active presence. Add a presence event handler Remove a presence event handler Clear presence events. Contract representing a "Push" or an outgoing message to the socket server Delegate for a message event. Add a message received handler Remove a message received handler Clear Message received handlers. The calling or parent channel The event name this push is registered under. Is push sent? The wrapped SocketRequest The payload (present in ) A unique ID representing this push. The server's response A timeout event handler. Resend this push, only called on a failed push attempt. Send this push. Contract for a realtime socket. Is this socket connected? Delegate for errors on this socket Delegate for handling socket state changes. Delegate for handling message received events. Delegate for handling a heartbeat event. Add a state changed handler. Remove a state changed handler. Clear state changed handlers. Add a message received handler. Remove a message received handler. Clear message received handlers. Add a heartbeat handler. Remove heartbeat handler. Clear heartbeat handlers. Add an error handler Remove an error handler Clear error handlers. Gets the roundtrip time of a single message between client and server. Connects to a socket Disconnects from a socket Generates a Message ref, used in Push a to the The phoenix specific reply event name for a message. Contract for a socket response The raw event name The parsed event type The opinionated payload matching a The unique id of this response The topic. Represents a Broadcast response with a modeled payload. The typed payload. Represents an arbitrary Broadcast response. The event. The payload. Represents an arbitrary Presence response. The ref for this event. (can be used to establish sequence) The previous ref for this presence event (can be used to establish sequence) Disables serialization of phoenix_ref Disables serialization of phoenix_prev_ref Handles a `postgres_changes` channel For Example in the js client: const databaseFilter = { schema: 'public', table: 'messages', filter: `room_id=eq.${channelId}`, event: 'INSERT', } Would translate to: new PostgresChangesOptions("public", "messages", $"room_id=eq.{channelId}"); Mapping of postgres changes listener types All event INSERT events UPDATE events DELETE events The schema for this listener, likely: `public` The table for this listener, can be: `*` matching all tables in schema. The filter for this listener The parameters passed to the server The stringified event listener type Postgres changes options. A postgres changes event. Hydrates the referenced record into a Model (if possible). Hydrates the old_record into a Model (if possible). NOTE: If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY to FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL`; The payload. The payload data. Options used to initialize Realtime Presence key option is used to track presence payload across clients Presence options. Represents a presence_diff response a Presence Diff payload The joining presences. The leaving presences. A presence diff payload The metas containing current presences A presence state payload response The metas containing joins and leaves Represents a realtime broadcast client. Broadcast follows the publish-subscribe pattern where a client publishes messages to a channel with a unique identifier. Other clients can elect to receive the message in real-time by subscribing to the channel with the same unique identifier. If these clients are online and subscribed then they will receive the message. Broadcast works by connecting your client to the nearest Realtime server, which will communicate with other servers to relay messages to other clients. A common use-case is sharing a user's cursor position with other clients in an online game. A model representing expected payload. The last received broadcast. Initializes a realtime broadcast helper class. Adds a broadcast event listener. Removes a broadcast event listener. Clears all broadcast event listeners Called by when a broadcast event is received, then parsed/typed here. Broadcasts an arbitrary payload Class representation of a channel subscription As to whether this Channel is Closed As to if this Channel has Errored As to if this Channel is currently Joined As to if this Channel is currently Joining As to if this channel is currently leaving The channel's topic (identifier) The Channel's current state. Options passed to this channel instance. The saved Broadcast Options, set in The saved Presence Options, set in The saved Postgres Changes Options, set in Flag stating whether a channel has been joined once or not. Flag stating if a channel is currently subscribed. Returns the instance. Returns a typed instance. Returns the instance. Returns a typed instance. Model representing a Presence payload The initial request to join a channel (repeated on channel disconnect) Buffer of Pushes held because of Socket availability Initializes a Channel - must call `Subscribe()` to receive events. Handles socket state changes, specifically when a socket reconnects this channel (if previously subscribed) should also rejoin. Registers a instance - allowing broadcast responses to be parsed. enables client to receive message it has broadcast instructs server to acknowledge that broadcast message was received Registers a instance - allowing presence responses to be parsed and state to be tracked. The model representing a presence payload. used to track presence payload across clients Thrown if called multiple times. Registers a state changed listener relative to this channel. Called when channel state changes. Removes a channel state changed listener Clears all channel state changed listeners Notifies registered listeners that a channel state has changed. Registers a message received listener, called when a socket message is received for this channel. Removes a message received listener. Clears message received listeners. Notifies registered listeners that a channel message has been received. Add a postgres changes listener. Should be paired with . The type of event this callback should process. Removes a postgres changes listener. The type of event this callback was registered to process. Clears all postgres changes listeners. Adds an error event handler. Removes an error event handler Clears Error Event Handlers Notifies listeners of a postgres change message being received. Registers postgres_changes options, can be called multiple times. Should be paired with Subscribes to the channel given supplied Options/params. Unsubscribes from the channel. Sends a `Push` request under this channel. Maintains a buffer in the event push is called prior to the channel being joined. Sends an arbitrary payload with a given payload type () Rejoins the channel. Enqueues a message. Generates the Join Push message by merging broadcast, presence, and postgres_changes options. Generates an auth push. If the channel errors internally (phoenix error, not transport) attempt rejoining. Sends the phoenix server a join message. Handles a received join response (received after sending on subscribe/reconnection) Called when a socket message is received, parses the correct event handler to pass to. Represents a realtime presence client. When a client subscribes to a channel, it will immediately receive the channel's latest state in a single message. Clients are free to come-and-go as they please, and as long as they are all subscribed to the same channel then they will all have the same Presence state as each other. If a client is suddenly disconnected (for example, they go offline), their state will be automatically removed from the shared state. A model representing expected payload. The Last State of this Presence instance. The Current State of this Presence instance. Initializes a realtime presence helper class. Add presence event handler for a given event type. Remove an event handler Clears all event handlers for a given type (if specified) or clears all handlers. Notifies listeners of state changes Called in two cases: - By `RealtimeChannel` when it receives a `presence_state` initializing message. - By `RealtimeChannel` When a diff has been received and a new response is saved. Triggers a diff comparison and emits events accordingly. "Tracks" an event, used with . Untracks an event. Sets the internal Presence State from the Socket connection handler. Returns whether or not the connection is alive. The Socket Endpoint Initializes this Socket instance. Connects to a socket server and registers event listeners. Disconnects from the socket server. Adds a listener to be notified when the socket state changes. Removes a specified listener from socket state changes. Notifies all listeners that the socket state has changed. Clears all of the listeners from receiving event state changes. Adds a listener to be notified when a message is received. Removes a specified listener from messages received. Notifies all listeners that the socket has received a message Clears all of the listeners from receiving event state changes. Adds a listener to be notified when a message is received. Removes a specified listener from messages received. Notifies all listeners that the socket has received a heartbeat Clears all of the listeners from receiving event state changes. Adds an error event handler. Removes an error event handler Clears Error Event Handlers Pushes formatted data to the socket server. If the connection is not alive, the data will be placed into a buffer to be sent when reconnected. Returns the latency (in millis) of roundtrip time from socket to server and back. Maintains a heartbeat connection with the socket server to prevent disconnection. Called when the socket opens, registers the heartbeat thread and cancels the reconnection timer. The socket has reconnected (or connected) The socket has disconnected, called either through a socket closing or erroring. Parses a received socket message into a non-generic type. Handles socket errors, increments reconnection count if a connection has been established at least once. Begins the reconnection thread with a progressively increasing interval. Generates an incrementing identifier for message references - this reference is used to coordinate requests with their responses. Returns the expected reply event name based off a generated message ref. Dispose of the web socket connection. Flushes `Push` requests added while a socket was disconnected. A generic, internal phoenix server response The response. The status. Options to initialize a socket. A user token (used for WALRUS permissions) A Supabase hosted public key Representation of a Socket Request, used by The type The topic being sent to The Event name The json serializable payload The unique ref for this request. The join ref (if applicable) A SocketResponse with support for Generically typed Payload The typed payload response Representation of a Socket Response. Represents a socket response The internal realtime topic. The internal, raw event given by the socket The typed, parsed event given by this library. The payload/response. An internal reference to this particular feedback loop. The raw JSON string of the received data. The record referenced. The previous state of the referenced record. A socket response payload. Displays Column information from the Database. Will always be an array but can be empty The timestamp of the commit referenced. Will either be a string or null The record referenced. Will always be an object but can be empty. The previous state of the referenced record. Will always be an object but can be empty. The Schema affected. The Table affected. The action type performed (INSERT, UPDATE, DELETE, etc.) The parsed type. Status of response The unparsed response object Either null or an array of errors. See: https://github.com/supabase/walrus/#error-states Presence joins (parsed later) Presence leaves (parsed later) The channel (system) The extension (system) The message (system) Simple method to form a query string (albeit poorly) from a dictionary. Generates a Channel topic string of format: `realtime{:schema?}{:table?}{:col.eq.:val?}`