Skip to main content

Interface: GdexStreamConfig

Options for GdexStreamService.

Properties​

PropertyTypeDescription
apiKey?stringPresents x-api-key on the WebSocket upgrade request, which the swap backend uses to serve the PRIVILEGED view (shadow swaps with the wallet unredacted). Without it, or with a wrong key, the connection is simply public: the server never says whether a privileged mode exists. It must travel as an HTTP header, because the server reads no other credential, and a browser WebSocket cannot set headers. So this option needs a constructor that accepts them as its third argument ({ headers }): the ws package on Node.js, or React Native's built-in WebSocket. It therefore REQUIRES webSocketImpl (the platform default is never assumed to honor headers, and a key that is silently dropped would look like a working privileged connection); the constructor throws otherwise. Use it from server-side code only: a key shipped inside a browser or app bundle is not a secret. Browser clients stay public.
reconnectAttempts?numberReconnect attempts after an unexpected close. Default 5.
reconnectDelayMs?numberDelay before the first reconnect attempt; doubles each attempt. Default 2000 ms.
requestTimeoutMs?numberHow long a request waits for its response. Default 15000 ms.
url?stringStream endpoint. Defaults to production (wss://dex-backend-prod1.defi.gala.com/ws).
webSocketImpl?unknownA standards-compatible WebSocket constructor. Required on Node.js older than 22, which has no global WebSocket (pass the one from the ws package).