Real-time sockets
Use the socket module only for SDK features that consume Ovok real-time events.
SocketProvider exposes a Socket.IO client to descendants; ordinary API requests
still go through OvokClient from @ovok/core.
import { OvokProvider } from "@ovok/core";
import { SocketProvider } from "@ovok/native/socket";
<OvokProvider client={client}>
<SocketProvider>
<RealtimeScreen />
</SocketProvider>
</OvokProvider>
Read the connection through useSocket and subscribe to AI events with
useAiEventListener from within the provider. Keep event handling idempotent because
real-time delivery can repeat or arrive after a screen has changed. Remove any
application-owned listeners when their owning screen unmounts.
The current provider observes network changes but has a known reconnection limitation: it may replace the socket without restoring listeners, and connection state can become stale. Treat reconnection as best effort; provide a refresh or retry path for user-visible features that depend on live events.