# snap_getWebSockets

> Reference documentation for the `snap_getWebSockets` method of the Snaps API.

<SnapsAPIReference method={{"name":"snap_getWebSockets","description":"Get the connected WebSockets for the Snap.","parameters":{"kind":"primitive","type":"null","description":"This method does not accept any parameters."},"result":{"kind":"array","type":"{ id: string; url: string; protocols: string[] }[]","description":"An array of connected WebSockets for the Snap.","element":{"kind":"object","type":"{ id: string; url: string; protocols: string[] }","description":null,"required":false,"properties":[{"kind":"primitive","type":"string","description":"The unique identifier of the WebSocket connection.","name":"id"},{"kind":"primitive","type":"string","description":"The URL of the WebSocket connection.","name":"url"},{"kind":"array","type":"string[]","description":"An array of subprotocols used in the WebSocket connection (if any).","element":{"kind":"primitive","type":"string","description":null},"name":"protocols"}]}},"subjectTypes":["snap"],"examples":[{"examples":[{"name":"Manifest","language":"json","content":"{\n  \"initialPermissions\": {\n    \"endowment:network-access\": {}\n  }\n}\n"},{"name":"Usage","language":"ts","content":"const webSockets = await snap.request({ method: 'snap_getWebSockets' })\nconsole.log(webSockets)\n// Example output:\n// [\n//   {\n//     id: 'websocket-1',\n//     url: 'wss://example.com/socket',\n//     protocols: ['protocol1', 'protocol2'],\n//   },\n//   {\n//     id: 'websocket-2',\n//     url: 'ws://example.org/endpoint',\n//     protocols: [],\n//   },\n// ]\n"}]}],"restricted":false}}  />
