Installation
Add InsForge to your Swift Package Manager dependencies:Enable Logging (Optional)
For debugging, you can configure the SDK log level and destination:
Log Destinations:
Use
.info or .error in production to avoid exposing sensitive data in logs.Mental model
The Swift 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 messages published to it.realtime.channels, subscription is checked against SELECT policies.
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.