snap_sendWebSocketMessage
Description
Send a message to an open WebSocket connection. The message will be sent to
the WebSocket connection with the specified ID, which must have been
previously opened by the snap using the snap_openWebSocket
method.
Parameters
id
stringrequiredThe ID of the WebSocket connection to send a message to.
message
number[] | stringrequiredThe message to send.
Example
await wallet.request({
method: "snap_sendWebSocketMessage",
params: {
id: "websocket-connection-id",
message: "Hello, WebSocket!", // or message: [1, 2, 3] for binary data
},
});