Plug for handling DB Sync WebSocket connections.
This plug handles the HTTP upgrade to WebSocket and validates the connection code or auth token before handing off to SyncWebsock.
Authentication Methods
Supports two authentication methods:
Session Code (ephemeral) - For manual one-time transfers
- Query param:
?code=ABC12345 - Session is tied to LiveView process
- Query param:
Connection Token (permanent) - For persistent connections
- Query param:
?token=xyz123... - Validated against database, subject to access controls
- Query param:
Usage
In your endpoint:
plug PhoenixKit.Modules.Sync.Web.SocketPlugOr mount at a specific path in router (done automatically by phoenix_kit_socket macro).