Skip to Content
Symmio Trading-SDK — the SDK surface for builders on HyperEVM
CoreNotificationswatchNotifications

watchNotifications

Subscribe to live position/quote state notifications for one account.

Opens (or reuses) one reconnecting socket to the chain’s notifications endpoint, sends the subscribe frame on every (re)connect, normalizes inbound frames into Notifications, and invokes your handlers. Watchers sharing the same endpoint and account share one socket; it closes when the last one unwatches.

This is a subscribe function, not a query — there are no query options. For a React binding, use the useNotifications hook.

import { watchNotifications } from "@symmio/trading-core"; const unwatch = watchNotifications(config, { account: "0xaccount...", onNotification: (n) => console.log(n.type, n.quoteId), onStatusChange: (status) => console.log(status), onError: (err) => console.error(err), }); // later, dispose (idempotent): unwatch();

Parameters

accountAddressrequired

SubAccount address to subscribe for.

chainIdnumberoptional

Target chain id. Defaults to the config’s defaultChainId.

onNotification(n: Notification) => voidrequired

Called for every normalized notification frame.

onStatusChange(s: SocketStatus) => voidoptional

Called whenever the underlying connection status changes. SocketStatus is "connecting" | "open" | "reconnecting" | "closing" | "closed".

onError(e: SymmError) => voidoptional

Called on a transport or parse error; does not stop the subscription.

Returns

Unwatch

Call to stop the subscription; idempotent. The pooled socket closes when the last watcher releases.

Throws

Throws a SymmError synchronously when the chain is unsupported or no WebSocket implementation is available.

Last updated on