Skip to main content
The WebSocket V2 Close command (Command Type: 9) signals the active WebSocket V2 connection to perform a clean close. Place at the end of an onMessage chain to terminate the connection once the desired condition is met.

Command Type

Command Type ID: 9

Parameters

No parameters. This command takes no configuration.

Usage Examples

Close After Receiving Target Data

Used at the end of an onMessage chain to stop the connection once desired data has been collected:
{
  "command": "websocket-v2",
  "params": {
    "url": "wss://stream.example.com",
    "onMessage": [
      { "id": 6, "type": "WS_V2", "params": {} },
      { "id": 1002, "type": "PARSE", "params": { "path": "$.events" } },
      { "id": 9, "type": "WS_V2", "params": {} }
    ]
  }
}

Common Use Cases

  • Single-Response Collection: Connect, receive one meaningful message, then close
  • Conditional Termination: Combined with If-Else, close only when a stopping condition is met