Remove Indexing Latency from your App using Relay Websockets
Our goal at Relay is to make multichain payments feel instant. Even when transactions confirm quickly onchain, API polling latency can degrade user experience. Connecting your app to Relay Websockets means your users get streamed updates of the status of their Relays for a speedier experience.
Websockets stream statuses to a connected client. To have Relay push status updates to your backend instead, configure a webhook.
The Websocket Service uses an API key for authentication and is available at the following URL wss://ws.relay.linkTo connect using an API key, provide your API key as a query param in the connection url:
const wss = new ws(`wss://ws.relay.link?apiKey=${YOUR_API_KEY}`);
The websocket server needs to restart to deploy updatesThe websocket server uses a rolling restart mechanism to deploy new changes. This will disconnect you and require you to reconnect to the websocket server. There is no downtime, as you are only disconnected once the new server is up and running. Please make sure to include logic in your implementation to handle these restarts, and reconnect accordingly.
Before sending any messages over the Websocket, wait for a ready message back from the server. The message looks like:
{ "type": "connection", // The type of operation "status": "ready", // The status of the operation "data": { "id": "9nqpzwmwh86" // Your socket id for debugging purposes }}
const ws = require("ws");const YOUR_API_KEY = "";const wss = new ws(`wss://ws.relay.link?apiKey=${YOUR_API_KEY}`);wss.on("open", function open() { console.log("Connected to Relay"); wss.on("message", function incoming(data) { console.log("Message received: ", JSON.stringify(JSON.parse(data))); // When the connection is ready, subscribe to the top-bids event if (JSON.parse(data).status === "ready") { console.log("Subscribing"); wss.send( JSON.stringify({ type: "subscribe", event: "request.status.updated", filters: { id: "0xae0827617d4ae75b406969971c2d4df9a8e8d819ff0f09581fb45ca123fcc7a0", }, }) ); // To unsubscribe, send the following message // wss.send( // JSON.stringify({ // type: 'unsubscribe', // event: 'request.status.updated', // }), // ); } });});
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Relay","description":"Relay is a developer platform that gives you instant global access to the onchain economy. Swap, pay, and transact across every blockchain from a single onchain balance using a simple set of enterprise-grade APIs.","colors":{"primary":"#4615C8","light":"#A7AAFF","dark":"#4615C8"},"logo":{"light":"https://mintcdn.com/unevenlabs/Gbv82V37Oid9F6eG/logo/relay-black.svg?fit=max\u0026auto=format\u0026n=Gbv82V37Oid9F6eG\u0026q=85\u0026s=7983e6e441ff77eeac7e17c03c2d0e8c","dark":"https://mintcdn.com/unevenlabs/Gbv82V37Oid9F6eG/logo/relay-white.svg?fit=max\u0026auto=format\u0026n=Gbv82V37Oid9F6eG\u0026q=85\u0026s=fbdcf916b96f42397c1470872ab80cda"},"favicon":"https://mintcdn.com/unevenlabs/f--GnNtyUvuqA2AW/favicon.png?fit=max\u0026auto=format\u0026n=f--GnNtyUvuqA2AW\u0026q=85\u0026s=d40a0a20b4bf062cea218d7eed38c576","api":{"openapi":["https://api.relay.link/documentation/json"],"examples":{"defaults":"required","languages":["curl","javascript","python"],"prefill":false},"mdx":{"server":["https://api.relay.link","https://api.testnets.relay.link"]}},"appearance":{"default":"light"},"navbar":{"links":[{"href":"https://support.relay.link/en/","label":"Support"},{"href":"https://forms.gle/XNeELYavjwoJwPEf7","label":"Get in Touch"}],"primary":{"type":"button","label":"Try Relay","href":"https://www.relay.link/"}},"footer":{"socials":{"twitter":"https://twitter.com/RelayProtocol"}},"integrations":{"intercom":{"appId":"b09ps4q8"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":["To quote bridges and swaps, look up chains and tokens, or track Relay transactions from an agent, use the Relay MCP server: `npx -y @relayprotocol/relay-mcp`. It is read-only and does not sign or broadcast transactions. Setup: https://docs.relay.link/resources/developing-with-ai.md","For Relay Protocol's trust model, security architecture, and audits, see https://docs.relay.link/references/protocol/security.md. For address screening, see https://docs.relay.link/security/transaction-screening.md."]},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"unevenlabs","hasAudioNarration":false,"actualSubdomain":"unevenlabs","customDomains":["docs.relay.link"],"gitSource":{"type":"github","owner":"relayprotocol","repo":"relay-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aee375253bbcb6253260176","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"default","tag":"API Reference","count":97},{"language":"default","tag":"RelayKit","count":48},{"language":"default","tag":"Relay Platform","count":29},{"language":"default","tag":"Relay Protocol","count":29},{"language":"default","tag":"Settlement","count":17},{"language":"default","tag":"Integration Guides","count":13},{"language":"default","tag":"Vaults","count":12},{"language":"default","tag":"Core Concepts","count":11},{"language":"default","tag":"SDK","count":11},{"language":"default","tag":"Features","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#navbar a[href*=\"/references\"]{padding-left:18px;padding-right:18px}.card-link{color:var(--tw-prose-links);text-decoration:none;font-weight:600;margin-top:10px;display:inline-block;margin-right:5px;border-bottom:1px solid transparent}.card-link:hover{border-bottom:1px solid rgb(var(--primary-light))}#ui-kit-overview-cards a>div>div:first-child{float:left;margin-right:12px}#ui-kit-overview-cards a>div h2{margin:0;display:inline}.relay-table{td:not(:first-child) {\n padding-left: 24px;\n }\n\n th:not(:first-child) {\n padding-left: 24px;\n }\n\n .chain-icon-light {\n display: block;\n }\n\n .chain-icon-dark {\n display: none;\n }}.dark .relay-table .chain-icon-light{display:none}.dark .relay-table .chain-icon-dark{display:block}#\\/references\\/api\\/core,#\\/references\\/api\\/utilities,#\\/references\\/api\\/advanced{pointer-events:none;font-weight:700}.loader{width:48px;height:48px;border:5px solid rgb(70 21 200);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}#body-user [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-origin-chain-id [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-destination-chain-id [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-origin-currency [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-destination-currency [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-amount [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400),#body-trade-type [data-component-part=\"field-info-pill\"]:has(>span.text-gray-400){display:none}#custom-vm-quicksets{display:flex;gap:10px;margin-top:10px;margin-left:16px;border-bottom:1px solid;border-color:rgb(var(--gray-200)/.7);padding-bottom:16px}#custom-vm-quicksets button{border-radius:4px;overflow:hidden;border:none;cursor:pointer;transition:opacity 0.2s ease;opacity:1}#custom-vm-quicksets button img{width:32px;height:32px}#custom-vm-quicksets button:hover{opacity:0.8}#custom-vm-quicksets-intro{font-weight:600;margin-top:20px;margin-left:16px}#hyperliquid-button{background-color:#fff;padding:2px;max-height:32px}@media (max-width: 699px){[class*=\"intercom-with-namespace\"],.intercom-lightweight-app-launcher{bottom:60px!important}}body:has(.homepage-bg) .nav-tabs-item[href=\"/what-is-relay\"]{color:rgb(75 85 99)!important;text-shadow:none!important}.dark body:has(.homepage-bg) .nav-tabs-item[href=\"/what-is-relay\"],body.dark:has(.homepage-bg) .nav-tabs-item[href=\"/what-is-relay\"]{color:rgb(156 163 175)!important}body:has(.homepage-bg) .nav-tabs-item[href=\"/what-is-relay\"]>div{background:transparent!important}.homepage-bg{width:100%;height:40vh;position:relative;background:var(--Violet-Light-9, #4615C8);pointer-events:none}.homepage-cards{display:flex;gap:24px;margin:40px 50px;justify-content:center}.homepage-card{max-width:400px;min-height:200px;padding:24px;border-radius:12px;border:1px solid rgba(0, 0, 0, 0.1);background-color:#fff;text-decoration:none;color:inherit;display:flex;flex-direction:column;gap:12px;max-width:300px;transition:background-color 0.2s, border-color 0.2s}.dark .homepage-card{border:1px solid rgba(255, 255, 255, 0.1);background-color:#1a1a1a}.homepage-card:hover .homepage-card-link{opacity:0.8}.homepage-card h3{margin:0;font-size:18px;font-weight:700;color:#000;margin-bottom:-8px}.dark .homepage-card h3{color:#fff}.homepage-card-description{margin:0 0 40px 0;font-size:14px;color:#666;line-height:1.5}.dark .homepage-card-description{color:#999}.homepage-card-link{font-size:14px;color:#4615C8;font-weight:500;margin-top:auto}.dark .homepage-card-link{color:#a78bfa}@media (max-width: 699px){.homepage-bg{height:30vh}.homepage-bg-text{font-size:24px!important}.homepage-bg-logo{width:200px}.homepage-cards{margin:40px 12px}}@media (max-width: 599px){.homepage-bg{height:20vh}.homepage-bg-text{font-size:20px!important}.homepage-bg-container>div{gap:0!important}}@media (max-width: 899px){.homepage-cards{flex-direction:column;align-items:center}.homepage-card{max-width:600px;width:100%}}.relay-checkbox{appearance:none;-webkit-appearance:none;width:12px;height:12px;border:1px solid #C8CCFF;border-radius:3px;background-color:#F7F8FF;cursor:pointer;position:relative;transition:all 0.15s ease;flex-shrink:0}.relay-checkbox:hover{border-color:#B4B8FF;background-color:#EFF1FF}.relay-checkbox:focus{outline:none;border-color:#4615C8;box-shadow:0 0 0 2px rgba(70, 21, 200, 0.15)}.relay-checkbox:checked{background-color:#4615C8;border-color:#4615C8}.relay-checkbox:checked:hover{background-color:#3B00B4;border-color:#3B00B4}.relay-checkbox:checked::after{content:'';position:absolute;left:3px;top:0px;width:4px;height:7px;border:solid #fff;border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.relay-checkbox:disabled{cursor:not-allowed;opacity:0.5;background-color:#EFF1FF;border-color:#D7DBFF}.dark .relay-checkbox{background-color:#141331;border-color:#4016B8}.dark .relay-checkbox:hover{border-color:#4C24D1;background-color:#221166}.dark .relay-checkbox:focus{border-color:#5B2AF9;box-shadow:0 0 0 2px rgba(91, 42, 249, 0.25)}.dark .relay-checkbox:checked{background-color:#4615C8;border-color:#4615C8}.dark .relay-checkbox:checked:hover{background-color:#3901AA;border-color:#3901AA}.dark .relay-checkbox:disabled{background-color:#221166;border-color:#4016B8}[data-page-title=\"Call Execution Integration Guide\"]{h2 #get-a-quote,\n h2 #execute-the-call,\n h2 #monitor-cross-chain-call-status {\n visibility: hidden;\n height: 0;\n margin: 0;\n padding: 0;\n }}[data-page-title=\"Bridging Integration Guide\"]{h2 #get-a-quote,\n h2 #execute-the-bridge,\n h2 #monitor-bridge-status {\n visibility: hidden;\n height: 0;\n margin: 0;\n padding: 0;\n }}.callout .prose>:first-child{margin-top:0}[data-cl-filter-bar]{position:sticky;top:var(--cl-sticky-top, 5rem);z-index:20;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:12px 0;margin-bottom:20px;border-bottom:1px solid var(--gray-200)}.dark [data-cl-filter-bar]{border-bottom-color:rgb(55 65 81)}div:has(>[data-component-part=\"update-label\"]){top:calc(var(--scroll-mt, 5rem) + var(--cl-bar-height, 0px))}[data-component-part=\"update-tag\"],[data-cl-filter-bar] button{cursor:pointer;padding:2px 8px;border:1px solid var(--gray-200);border-radius:9999px;transition:border-color 0.15s,\n color 0.15s,\n background-color 0.15s}[data-cl-filter-bar] button{font-size:0.875rem;font-weight:500;line-height:1.5;color:rgb(107 114 128);background:transparent}[data-component-part=\"update-tag\"]:hover,[data-component-part=\"update-tag\"][data-cl-active=\"true\"],[data-cl-filter-bar] button:hover,[data-cl-filter-bar] button[data-cl-active=\"true\"]{border-color:rgb(var(--primary) / var(--tw-text-opacity, 1));color:rgb(var(--primary) / var(--tw-text-opacity, 1))}[data-component-part=\"update-tag\"][data-cl-active=\"true\"],[data-cl-filter-bar] button[data-cl-active=\"true\"]{background:rgb(var(--primary) / 0.08)}.dark [data-component-part=\"update-tag\"],.dark [data-cl-filter-bar] button{border-color:rgb(55 65 81);color:rgb(156 163 175)}.dark [data-component-part=\"update-tag\"]:hover,.dark [data-component-part=\"update-tag\"][data-cl-active=\"true\"],.dark [data-cl-filter-bar] button:hover,.dark [data-cl-filter-bar] button[data-cl-active=\"true\"]{border-color:rgb(var(--primary-light));color:rgb(var(--primary-light))}.dark [data-component-part=\"update-tag\"][data-cl-active=\"true\"],.dark [data-cl-filter-bar] button[data-cl-active=\"true\"]{background:rgb(var(--primary-light) / 0.14)}"}],"page":{"pagePath":"references/api/api_guides/websockets","slug":"/references/api/api_guides/websockets","pageMetadata":{"title":"Websockets","description":"Remove Indexing Latency from your App using Relay Websockets","href":"/references/api/api_guides/websockets"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Remove Indexing Latency from your App using Relay Websockets\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Info,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Our goal at Relay is to make multichain payments feel instant. Even when transactions confirm quickly onchain, API polling latency can degrade user experience. Connecting your app to Relay Websockets means your users get streamed updates of the status of their Relays for a speedier experience.`}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`Websockets stream statuses to a connected client. To have Relay push status updates to your backend instead, configure a `,_jsx(_components.a,{href:`/references/api/api_guides/webhooks`,children:`webhook`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`relay-status-websockets`,children:`Relay Status Websockets`}),`\n`,_jsx(_components.p,{children:`Relay Status Websockets specifically stream transaction statuses for both cross and same-chain status, though the stages differ slightly.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.strong,{children:`status`})}),_jsx(_components.th,{children:_jsx(_components.strong,{children:`indication`})})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`waiting`}),_jsx(_components.td,{children:`waiting for origin chain deposit`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`depositing`}),_jsx(_components.td,{children:`origin deposit confirmed via /execute API, fill pending`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`pending`}),_jsx(_components.td,{children:`origin chain deposit confirmed, fill pending submission`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`submitted`}),_jsx(_components.td,{children:`fill submitted on destination chain`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`success`}),_jsx(_components.td,{children:`fill succeeded`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`failure`}),_jsx(_components.td,{children:`fill failed`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`refund`}),_jsx(_components.td,{children:`refunded`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`integrating-relay-websockets`,children:`Integrating Relay Websockets`}),`\n`,_jsxs(_components.p,{children:[`Refer to the guide below on how to integrate the websocket into your application. You may also refer to the `,_jsx(_components.a,{href:`/references/websockets/intent-status`,children:`websocket reference`}),` for more details.`]}),`\n`,_jsx(Heading,{level:`3`,id:`events`,children:_jsx(_components.strong,{children:`Events`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.strong,{children:`Event`})}),_jsx(_components.th,{children:_jsx(_components.strong,{children:`Tags`})}),_jsx(_components.th,{children:_jsx(_components.strong,{children:`Event Description`})})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`request.status.updated`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`id`})}),_jsx(_components.td,{children:`Triggered status of the request changes.`})]})})]}),`\n`,_jsx(Heading,{level:`2`,id:`authentication`,children:_jsx(_components.strong,{children:`Authentication`})}),`\n`,_jsxs(_components.p,{children:[`The Websocket Service uses an API key for authentication and is available at the following URL `,_jsx(_components.code,{children:`wss://ws.relay.link`})]}),`\n`,_jsx(_components.p,{children:`To connect using an API key, provide your API key as a query param in the connection url:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:\"const wss = new ws(`wss://ws.relay.link?apiKey=${YOUR_API_KEY}`);\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`The websocket server needs to restart to deploy updates`})}),_jsx(_components.p,{children:`The websocket server uses a rolling restart mechanism to deploy new changes. This will disconnect you and require you to reconnect to the websocket server. There is no downtime, as you are only disconnected once the new server is up and running. Please make sure to include logic in your implementation to handle these restarts, and reconnect accordingly.`})]}),`\n`,_jsx(Heading,{level:`2`,id:`interacting-with-the-websocket`,children:_jsx(_components.strong,{children:`Interacting with the Websocket`})}),`\n`,_jsx(_components.p,{children:`Before sending any messages over the Websocket, wait for a ready message back from the server. The message looks like:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"connection\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The type of operation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ready\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The status of the operation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\t\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"9nqpzwmwh86\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Your socket id for debugging purposes`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\t}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`subscribing-with-filters`,children:_jsx(_components.strong,{children:`Subscribing with Filters`})}),`\n`,_jsx(_components.p,{children:`Below is an example on how to subscribe to a websocket using filters.`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Subscribe`,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"subscribe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"event\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"request.status.updated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"filters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xae0827617d4ae75b406969971c2d4df9a8e8d819ff0f09581fb45ca123fcc7a0\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Subscribe Response`,numberOfLines:`10`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"subscribe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\t\"event\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"request.status.updated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\t\"filters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\t\t\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xae0827617d4ae75b406969971c2d4df9a8e8d819ff0f09581fb45ca123fcc7a0\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\t\t}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\t}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`unsubscribing`,children:_jsx(_components.strong,{children:`Unsubscribing`})}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Unsubscribe`,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"unsubscribe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"event\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"request.status.updated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"filters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0xae0827617d4ae75b406969971c2d4df9a8e8d819ff0f09581fb45ca123fcc7a0\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Unsubscribe Response`,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"unsubscribe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\t\t\"event\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"request.status.updated\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\t}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsx(Tip,{children:`Unsubscribing is not required if disconnecting from the websocket as the server cleans up automatically.`}),`\n`,_jsx(Heading,{level:`2`,id:`example`,children:_jsx(_components.strong,{children:`Example`})}),`\n`,_jsx(Heading,{level:`3`,id:`javascript`,children:_jsx(_components.strong,{children:`Javascript`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`npm install ws`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`35`,language:`jsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`jsx`,children:_jsxs(_components.code,{language:`jsx`,numberOfLines:`35`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ws`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ws\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` YOUR_API_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` wss`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` ws`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`wss://ws.relay.link?apiKey=\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`YOUR_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`wss`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"open\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` open`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Connected to Relay\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wss`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` incoming`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Message received: \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // When the connection is ready, subscribe to the top-bids event`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ready\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Subscribing\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wss`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"subscribe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"request.status.updated\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` filters:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0xae0827617d4ae75b406969971c2d4df9a8e8d819ff0f09581fb45ca123fcc7a0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // To unsubscribe, send the following message`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // wss.send(`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // JSON.stringify({`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // type: 'unsubscribe',`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // event: 'request.status.updated',`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // );`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Websockets","description":"Remove Indexing Latency from your App using Relay Websockets","href":"/references/api/api_guides/websockets"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Relay Status Websockets","slug":"relay-status-websockets","depth":2,"children":[]},{"title":"Integrating Relay Websockets","slug":"integrating-relay-websockets","depth":2,"children":[{"title":"Events","slug":"events","depth":3,"children":[]}]},{"title":"Authentication","slug":"authentication","depth":2,"children":[]},{"title":"Interacting with the Websocket","slug":"interacting-with-the-websocket","depth":2,"children":[{"title":"Subscribing with Filters","slug":"subscribing-with-filters","depth":3,"children":[]},{"title":"Unsubscribing","slug":"unsubscribing","depth":3,"children":[]}]},{"title":"Example","slug":"example","depth":2,"children":[{"title":"Javascript","slug":"javascript","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/unevenlabs/e205e0c83de02f5e/script.js","/_mintlify/custom/unevenlabs/90d7a6a8bc7d1a3b/content/intercom-opener.js","/_mintlify/custom/unevenlabs/a13c5467619df0df/iframe-resizer.js","/_mintlify/custom/unevenlabs/411e1fdad39a2d9e/posthog.js","/_mintlify/custom/unevenlabs/9cf2d871386c2976/playground-enhancer.js"],"subdomain":"unevenlabs","siteName":"Relay","title":"Websockets - Relay","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-20T17:35:04.489Z","originalFileLocation":"references/api/api_guides/websockets.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Remove Indexing Latency from your App using Relay Websockets\">\u003cmeta data-mint-head name=\"application-name\" content=\"Relay\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Websockets - Relay\">\u003cmeta data-mint-head property=\"og:description\" content=\"Remove Indexing Latency from your App using Relay Websockets\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Relay\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.relay.link/references/api/api_guides/websockets\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://unevenlabs.mintlify.site/_mintlify/api/og/v2?division=Integration+Guides\u0026amp;title=Websockets\u0026amp;description=Remove+Indexing+Latency+from+your+App+using+Relay+Websockets\u0026amp;theme=bb8130bdebc4204a02b71ad8\u0026amp;signature=7b125cf75198b6755783c0b1f7a1490ddfac9cb4ed73c611a2f2940293642cb7\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Websockets - Relay\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Remove Indexing Latency from your App using Relay Websockets\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://unevenlabs.mintlify.site/_mintlify/api/og/v2?division=Integration+Guides\u0026amp;title=Websockets\u0026amp;description=Remove+Indexing+Latency+from+your+App+using+Relay+Websockets\u0026amp;theme=bb8130bdebc4204a02b71ad8\u0026amp;signature=7b125cf75198b6755783c0b1f7a1490ddfac9cb4ed73c611a2f2940293642cb7\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/unevenlabs/P-TdogRhaTE5DlJS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Relay\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4615C8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.relay.link/references/api/api_guides/websockets\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/references/api/api_guides/websockets.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.relay.link/#organization\",\"name\":\"Relay\",\"url\":\"https://docs.relay.link\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/unevenlabs/Gbv82V37Oid9F6eG/logo/relay-black.svg?fit=max\u0026auto=format\u0026n=Gbv82V37Oid9F6eG\u0026q=85\u0026s=7983e6e441ff77eeac7e17c03c2d0e8c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.relay.link#website\",\"name\":\"Relay\",\"url\":\"https://docs.relay.link\",\"publisher\":{\"@id\":\"https://docs.relay.link/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.relay.link/references/api/api_guides/websockets#webpage\",\"url\":\"https://docs.relay.link/references/api/api_guides/websockets\",\"name\":\"Websockets\",\"description\":\"Remove Indexing Latency from your App using Relay Websockets\",\"dateModified\":\"2026-10-20T17:35:04.489Z\",\"isPartOf\":{\"@id\":\"https://docs.relay.link#website\"},\"breadcrumb\":{\"@id\":\"https://docs.relay.link/references/api/api_guides/websockets#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.relay.link/references/api/api_guides/websockets#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\" \",\"item\":\"https://docs.relay.link/references/api/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Integration Guides\",\"item\":\"https://docs.relay.link/references/api/api_guides/bridging-integration-guide\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Websockets\",\"item\":\"https://docs.relay.link/references/api/api_guides/websockets\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.relay.link/references/api/api_guides/websockets#article\",\"headline\":\"Websockets\",\"name\":\"Websockets\",\"description\":\"Remove Indexing Latency from your App using Relay Websockets\",\"url\":\"https://docs.relay.link/references/api/api_guides/websockets\",\"mainEntityOfPage\":{\"@id\":\"https://docs.relay.link/references/api/api_guides/websockets#webpage\"},\"dateModified\":\"2026-10-20T17:35:04.489Z\",\"publisher\":{\"@id\":\"https://docs.relay.link/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.relay.link#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Relay\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Relay","nav":{"global":null,"tabs":[{"tab":"Relay Platform","pages":[{"title":"Relay Platform","href":"/what-is-relay"}]},{"tab":"API Reference","groups":[{"group":" ","pages":[{"title":"API Overview","href":"/references/api/overview"},{"title":"Quickstart","href":"/references/api/quickstart"},{"title":"Apps, API keys, and Rate Limits","href":"/references/api/api-keys"},{"group":"Core Concepts","pages":[{"title":"Understanding Step Execution","href":"/references/api/api_core_concepts/step-execution"},{"title":"Wallet Detection","href":"/references/api/api_core_concepts/wallet-detection"},{"title":"Cost \u0026 Fee Structure","href":"/references/api/api_core_concepts/fees"},{"title":"Refunds","href":"/references/api/api_core_concepts/refunds"},{"title":"Input Validation","href":"/references/api/api_core_concepts/input-validation"},{"title":"Trade Types","href":"/references/api/api_core_concepts/trade-types"},{"title":"Surplus \u0026 Shortage","href":"/references/api/api_core_concepts/surplus-and-shortage"},{"title":"Handling Quote Errors","href":"/references/api/api_core_concepts/handling-errors"},{"title":"Handling Rate Limits","href":"/references/api/api_core_concepts/handling-rate-limits"},{"title":"Handling Execution Errors","href":"/references/api/api_core_concepts/execution-errors"},{"title":"Contract Compatibility","href":"/references/api/api_core_concepts/contract-compatibility"}]},{"group":"Integration Guides","pages":[{"title":"Bridging Integration Guide","href":"/references/api/api_guides/bridging-integration-guide"},{"title":"Call Execution Integration Guide","href":"/references/api/api_guides/calling-integration-guide"},{"title":"Transaction Indexing","href":"/references/api/api_guides/transaction-indexing"},{"title":"Base Builder Codes","href":"/references/api/api_guides/builder-codes"},{"title":"Smart Accounts in Relay","href":"/references/api/api_guides/smart-accounts"},{"group":"Chain Support Guides","pages":[{"title":"Testnet Support","href":"/references/api/api_guides/testnet"},{"title":"Solana Support","href":"/references/api/api_guides/solana"},{"title":"Bitcoin Support","href":"/references/api/api_guides/bitcoin"},{"title":"Hyperliquid Support","href":"/references/api/api_guides/hyperliquid-support"},{"title":"Lighter Support","href":"/references/api/api_guides/lighter-support"}]},{"title":"Deep Linking","description":"How to deep link to the Relay App","href":"/references/api/api_guides/deep-linking"},{"title":"Websockets","href":"/references/api/api_guides/websockets"},{"title":"Webhooks","description":"Simplify your Integration with Low-Latency Relay Webhooks","href":"/references/api/api_guides/webhooks"}]},{"group":"Migration Guides","pages":[{"title":"Migrating to Requests v3","href":"/references/api/api_guides/migrating-to-requests-v3"},{"title":"Migrating to Currencies v2","href":"/references/api/api_guides/migrating-to-currencies-v2"},{"title":"Migrating to Token Price v2","href":"/references/api/api_guides/migrating-to-token-price-v2"}]},{"group":"Chains, Tokens, Contracts","pages":[{"title":"Supported Chains","href":"/references/api/api_resources/supported-chains"},{"title":"Contract Addresses","href":"/references/api/api_resources/contract-addresses"},{"title":"Supported Tokens \u0026 Routes","href":"/references/api/api_resources/supported-routes"}]},{"title":"Troubleshooting","href":"/references/api/troubleshooting"}]},{"group":"API Reference","pages":[{"title":"Core","href":"/references/api/core"},{"title":"Get Quote","openapi":"post /quote/v2","href":"/references/api/get-quote-v2"},{"title":"Submit Permit","openapi":"post /execute/permits","href":"/references/api/execute-permits"},{"title":"Get Status","openapi":"get /intents/status/v3","href":"/references/api/get-intents-status-v3"},{"title":"Get Requests","openapi":"get /requests/v3","href":"/references/api/get-requests"},{"title":"Get Published Requests","openapi":"get /published-requests","href":"/references/api/get-published-requests"},{"title":"Utilities","href":"/references/api/utilities"},{"title":"Get Chains","openapi":"get /chains","href":"/references/api/get-chains"},{"title":"Get Chains Liquidity","openapi":"get /chains/liquidity","href":"/references/api/get-chains-liquidity"},{"title":"Get Currencies","openapi":"post /currencies/v2","href":"/references/api/get-currencies-v2"},{"title":"Get Currency Classifications","openapi":"get /currencies/classifications","href":"/references/api/get-currency-classifications"},{"title":"Get Token Price","openapi":"get /currencies/token/price/v2","href":"/references/api/get-token-price-v2"},{"title":"Transactions Index","openapi":"post /transactions/index","href":"/references/api/transactions-index"},{"title":"Transactions Single","openapi":"post /transactions/single","href":"/references/api/transactions-single"},{"title":"Deposit Address Reindex","openapi":"post /transactions/deposit-address/reindex","href":"/references/api/deposit-address-reindex"},{"title":"Get App Fee Balances","openapi":"get /app-fees/{wallet}/balances","href":"/references/api/get-app-fee-balances"},{"title":"Get Balance Events","openapi":"get /balance/{wallet}/events","href":"/references/api/get-balance-events"},{"title":"Claim App Fees","openapi":"post /app-fees/{wallet}/claim","href":"/references/api/claim-app-fees"},{"title":"Get Usage","openapi":"get /metrics/usage","href":"/references/api/get-usage"},{"title":"Advanced","href":"/references/api/advanced"},{"title":"Fast Fill","openapi":"post /fast-fill","href":"/references/api/fast-fill"},{"title":"Get Swap Sources","openapi":"get /swap-sources","href":"/references/api/get-swap-sources"},{"title":"Execute Gasless Txs","sidebarTitle":"Gasless Execution","openapi":"post /execute","href":"/references/api/execute"},{"group":"Withdrawals","pages":[{"title":"Attest Deposit","openapi":"post /withdrawals/attest-deposit","href":"/references/api/attest-deposit"},{"title":"Get Recovery Balances","openapi":"get /withdrawals/balances","href":"/references/api/get-withdrawal-balances"},{"title":"Request Withdrawal","openapi":"post /withdrawals/request","href":"/references/api/request-withdrawal"},{"title":"Get Withdrawal Status","openapi":"get /withdrawals/status","href":"/references/api/get-withdrawal-status"}]},{"group":"Deprecated","pages":[{"title":"Get Requests (v2)","openapi":"get /requests/v2","href":"/references/api/get-requests-v2"},{"title":"Get Price","openapi":"post /price","href":"/references/api/get-price"},{"title":"Get Config","openapi":"get /config/v2","href":"/references/api/get-config"},{"title":"Get Execution Status","openapi":"get /intents/status","href":"/references/api/get-intents-status"},{"title":"Get Currencies (v1)","openapi":"post /currencies/v1","href":"/references/api/get-currencies"},{"title":"Get Token Price (v1)","openapi":"get /currencies/token/price","href":"/references/api/get-token-price"},{"title":"Get Quote","openapi":"post /quote","href":"/references/api/get-quote"}]}]},{"group":"Websockets","pages":[{"title":"Intent Status","asyncapi":"websocket-reference.json relay-ws","href":"/references/websockets/intent-status"}]}]},{"tab":"RelayKit","pages":[{"title":"RelayKit","href":"/references/relay-kit/overview"}]},{"tab":"Relay Protocol","pages":[{"title":"Relay Protocol","href":"/references/protocol/overview"}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"basePath":"","title":"Websockets - Relay","buildId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","deploymentId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","dynamics":[],"chunks":[]}