createClient
Creates a Socket.IO-backed URQL client with custom exchanges.
Signature
Section titled “Signature”function createClient(options: ClientOptions): { client: UrqlClient manager: SocketManager invalidate: (target: string | DocumentNode | Array) => void}Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
path | string | '/ws/' | Socket.IO server path |
transports | string[] | ['websocket'] | Allowed transports |
graphqlNamespace | string | 'graphql' | Socket.IO namespace to connect to |
onConnect | () => object | — | Return auth data for the connection |
Return Values
Section titled “Return Values”| Property | Type | Description |
|---|---|---|
client | UrqlClient | Configured URQL client with Suspense enabled |
manager | SocketManager | The underlying Socket.IO manager |
invalidate | Function | Manually invalidate cached operation results |
invalidate
Section titled “invalidate”// Single query by operation nameinvalidate('Users')
// Single query by document nodeinvalidate(UsersDocument)
// Multiple queriesinvalidate(['Users', ProjectsDocument])waitForResult
Section titled “waitForResult”Exported from @requence/socketql/client, this utility returns a promise that resolves when specific query results arrive:
import { waitForResult } from '@requence/socketql/client'
await waitForResult('Users')await waitForResult(['Users', 'Projects'])