Skip to main content

Installation

  1. Add InsForge dependencies to your project
build.gradle.kts:
  1. Initialize InsForge SDK
  1. Enable Logging (Optional)
For debugging, you can configure the SDK log level:
Use NONE or ERROR in production to avoid exposing sensitive data in logs.

Android Initialization

  1. Add Chrome Custom Tabs dependency to your build.gradle.kts:
  1. Initialize InsForge SDK (With Chrome Custom Tabs and Session Storage)
  1. Use Jetpack DataStore for Session Storage (Optional)

Mental model

The Kotlin SDK connects to InsForge Realtime over Socket.IO. Subscribe to channel names such as order:123 or chat:room-1, then listen for event names published to those channels. Events are published by database triggers that call realtime.publish(...) or by clients that publish to a channel they have already joined. See Realtime overview for the channel and RLS model.

Quick start

connect()

Establish a realtime connection.
Monitor connection state:

subscribe()

Subscribe to a channel and receive the current presence snapshot.

publish()

Publish an event to a channel.
The client must subscribe to a channel before publishing to that same channel.
If RLS is enabled on realtime.messages, publish is also checked against INSERT policies.

on()

Register an event listener.
Connection and system events:

once()

Listen for an event once.

off()

Remove an event listener.

unsubscribe()

Leave a channel.

disconnect()

Close the realtime connection.

getSubscribedChannels()

Return locally subscribed channels.

Presence

Successful subscriptions return a presence snapshot. Listen for presence:join and presence:leave to update local online state. Presence is ephemeral. It is not a durable room membership table.