Create HTTP/WebSocket data source
create_data_source_http_wsIngest live data using HTTP polling with custom methods and headers, or WebSocket streams with auto-reconnect. Map JSON fields to CHOP channels via JSONPath selectors.
Instructions
Advanced live-data ingest for HTTP polling and WebSocket streams — the richer-transport sibling of create_data_source. http_poll: webclientDAT driven by a timerCHOP so polling cadence is a real CHOP signal you can retune/sync; supports custom HTTP method, headers, and body. websocket: websocketDAT with auto-reconnect, persistent connection. Both: JSONPath-lite selectors ($.key, $.key.sub, $.arr[0].field — no wildcards/filters) map response fields to named channels on an output Null CHOP ready for bind_to_channel. Raw body exposed on a Null DAT. Use create_data_source for simple one-knob JSON/CSV polling; use this tool when you need real POST/headers, fine-cadence timer sync, or a WebSocket stream.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Transport. | http_poll |
| parent_path | No | COMP to build inside. | /project1 |
| name | No | Base name for the created baseCOMP; defaults to data_src_<mode>. | |
| url | Yes | Endpoint URL. http(s):// for http_poll; ws:// or wss:// for websocket. Note: webclientDAT runs inside TD (no browser CORS). wss:// with self-signed certs may silently fail (statusCode 0). JSONPath selector support: $.name, $.key.sub, $.arr[0].field — no wildcards or filters. | |
| method | No | HTTP method. http_poll only; ignored for websocket. | get |
| headers | No | Request headers (http_poll) or connect headers (websocket; best-effort, param may vary by TD build). | |
| body | No | Request body. http_poll only; caller pre-serializes JSON. | |
| selectors | Yes | JSONPath-lite selectors. Each name becomes a Null CHOP channel and must be unique. path must start with $. Supported: $.key, $.key.sub, $.arr[0], $.arr[0].key. Non-numeric or missing values fall back to 0 with a warning. | |
| poll_seconds | No | Polling interval in seconds. http_poll only; drives the timerCHOP cycle. | |
| reconnect_seconds | No | Seconds between reconnect attempts. websocket only. | |
| expose_controls | No | Surface live Active, Poll/Reconnect, and per-selector LastValue readouts. | |
| static_sample | No | Seed values keyed by selector name. Missing names default to 0.5. |