Installation
- Add InsForge dependencies to your project
- Maven Central
- GitHub Packages
build.gradle.kts:
- Initialize InsForge SDK
- Enable Logging (Optional)
Use
NONE or ERROR in production to avoid exposing sensitive data in logs.Android Initialization
- Add Chrome Custom Tabs dependency to your
build.gradle.kts:
- Initialize InsForge SDK (With Chrome Custom Tabs and Session Storage)
- Use Jetpack DataStore for Session Storage (Optional)
Mental model
The Kotlin SDK connects to InsForge Realtime over Socket.IO. Subscribe to channel names such asorder: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.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.
realtime.messages, publish is also checked against INSERT policies.
on()
Register an event listener.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 forpresence:join and presence:leave to update local online state.
Presence is ephemeral. It is not a durable room membership table.