Skip to main content
The Web Socket Listen command (Command Type: 2) listens for incoming messages from the WebSocket server. The connection closes automatically after the timeout or after receiving a specified number of messages.

Command Type

Command Type ID: 2

Parameters

ParameterTypeDescriptionRequired
timeoutnumberTimeout for the command in millisecondsYes
closeAfterMessagenumberNumber of messages to receive before closing the connectionNo

Usage Examples

Listen for 30 Seconds

{
  "command": "websocket-listen",
  "params": {
    "timeout": 30000
  }
}

Listen for Exactly 1 Message

{
  "command": "websocket-listen",
  "params": {
    "timeout": 10000,
    "closeAfterMessage": 1
  }
}

Listen for 10 Messages

{
  "command": "websocket-listen",
  "params": {
    "timeout": 60000,
    "closeAfterMessage": 10
  }
}