onMessage chain to terminate the connection once the desired condition is met.
Command Type
Command Type ID: 9Parameters
No parameters. This command takes no configuration.Behavior and Edge Cases
- It signals the connection to close cleanly; any frames already buffered are processed before the socket actually closes (the
onClosehook then runs). - Calling it when there is no active connection is a safe no-op — it does nothing and raises no error. This means it is safe to place at the end of an
onConnectoronMessagechain even if the socket has already closed. - After a close, the step publishes its current accumulated result once; a mid-flow (non-last) step uses this to capture a one-time snapshot and move on.
Usage Examples
Close After Receiving Target Data
Used at the end of anonMessage chain to stop the connection once desired data has been collected:
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