Skip to content

[Connection Status] No way to detect silent disconnections / connection state #5

@tom-eberle

Description

@tom-eberle

Hi Convex team 👋

I’m running Convex in production with the Swift SDK, and I’m hitting a recurring problem:

  • The app will sometimes silently drop the Convex connection (likely the WebSocket getting wedged or a transport error).
  • After that, all queries/mutations/subscriptions stop working, but my SubscriptionStore has no idea that the client is disconnected.
  • There’s currently no public API in Swift to check connection state or to observe state changes.

In other SDKs there is such an API:

  • JS: client.subscribeToConnectionState(cb)
  • Rust: with_on_state_change(...)

But in Swift, we only have subscribe, mutation, action, and authState. That means I cannot build health checks or automatically reset the client when the socket goes down.

👉 Request:
Would it be possible to expose a connection state publisher / callback in the Swift SDK, similar to JS and Rust? That would let us reliably detect:

  • Connected
  • Reconnecting
  • Disconnected

Right now the only workaround is to implement my own "heartbeat" query or ping mutations, but this feels like a hack for something the SDK should expose natively.

Thanks a lot! The SDK works great otherwise, this would really improve production stability. 🙏

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions