For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content
  • Snap

snap_openWebSocket

Open a WebSocket connection to the specified URL with optional protocols.

Note: This method is only available to snaps that have the endowment:network-access permission.

Parameters​

object
required

The request parameters for the snap_openWebSocket method.

url

string
required

The wss:// URL of the WebSocket connection to open.

protocols

string[]

The optional protocols to use for the WebSocket connection.

Returns​

string

The ID of the opened WebSocket connection, which can be used to reference the connection in subsequent calls to snap_sendWebSocketMessage and snap_closeWebSocket.

Example

{
"initialPermissions": {
"endowment:network-access": {}
}
}