Data sources (incoming)

Data sources are where live data enters Routix Dash. Create and manage them from the menu under Data sources.

Each source has a name and a type (HTTP, HTTP stream, Video, MQTT, WebSocket, or Timer). Every type except HTTP and Video can have optional transformers. An HTTP source uses an Actions / Transformers pipe instead: at least one HTTP request, plus optional expressions, JSONPath, Lua, JavaScript, Stop pipeline, or Debounce.

One source can feed many data pieces. Set it as a data piece root source so components inherit it, or pick a different source on a component.

On the Data sources screen, swipe a row right to left to delete a source. Inside a source's editor, swipe an action or transformer row right to left to remove it.

The editor is titled New data source when you add a source and Data source when you edit one. Once you type a Name, it appears as a subtitle under the Name field.

The last setting in a source editor is Data: your own notes or data, up to 5120 characters, as plain text or JSON. It is stored as is and not evaluated, and scripts cannot read it. Don't put secrets there. See Components.

Unlike destinations, sources don't send anything out — they receive data (or, for Timer, produce it on a schedule) and store it as value, which every linked data piece reads. A Video source is the exception: it has no value and passes pictures straight to Video components.

An HTTP source is incoming only: it runs an Actions / Transformers pipe (or Trigger data source(s) does). Sending from a component is a tap HTTP request, MQTT send, or WebSocket send on this component, or Trigger data destination for a reusable outbound setup. See Tap actions.

Types of sources

Type What it does
HTTP Runs an Actions / Transformers pipe on a timer or on demand. At least one HTTP request (GET by default), plus optional expressions, JSONPath, Lua, JavaScript, Stop pipeline, or Debounce. Headers, query or body parameters, timeout, and TLS options live on each request.
HTTP stream Keeps one response open and turns each line, JSON line, custom split, or raw chunk into the source value. Optional On prepare actions (under Events) run before each connection.
Video Shows live video from a camera in a Video component. Reads an MJPEG stream over HTTP. Has no value, so labels and transformers do not use it.
MQTT Subscribes to one or more topic filters through a shared MQTT connection. Detects whether the message is text, JSON, or an image automatically.
WebSocket Receives messages through a shared WebSocket connection (raw WebSocket, SSE, or Socket.IO-style events).
Timer Emits a fixed string you write, on a timer or on demand — handy for placeholders, test data, or driving component transformers with a clock.

Auto or manual

HTTP and Timer sources have a Trigger setting:

Mode What happens
Auto (periodic) HTTP polls and Timer ticks run in the background on their interval.
Manual Nothing happens in the background. The source only refreshes when you trigger it yourself, or when a tap action runs Trigger data source(s).

An HTTP stream has Keep connected instead: on, it stays open and connects again after it ends; off, it connects only on demand. A Video source has Keep connected too (see Video). MQTT and WebSocket sources receive messages whenever their shared connection is up — that connection's Keep connected decides whether it stays online.

Default value

Every source except Video has Default value. Linked data pieces show it until the source receives data. A value saved on your device from an earlier session is used instead, when one exists.

Leave it empty if you want data pieces to stay blank until live data arrives. You can type plain text or JSON.

HTTP in Auto (periodic) and Timer ticks always run the rest of the chain — source transformers (or the Actions / Transformers pipe), data pieces, and components, including interpolating {{ source_value("Name") }} on other data pieces. That happens even when Default value is empty or the result did not change.

MQTT, WebSocket, and Manual sources apply Default value once on load when it is set, so linked data pieces and components can start with a value. An empty Default value does not run that chain. After that, only a new message (or a manual trigger) updates them.

You can include {{ source_value("Name") }} or {{ env.my_key }} — a simple expression between double braces. Names here are value and raw for this source, plus source_value("Name"), source_raw("Name"), and env. Tap names transformed and ctx are not available.

If an expression can't be evaluated, HTTP, MQTT, and WebSocket skip the default; a Timer source skips that tick. When another source's value changes, this default is filled in again if this source still has no incoming data.

On a Timer source, Default value is the string sent on each tick — that is where interpolation happens.

Expressions in source fields

The same {{ }} syntax as tap send is available in:

The app keeps your template as you typed it. It fills in the expression when it fetches, subscribes, ticks, or applies the default. MQTT and WebSocket subscribe to the filled-in names and update them when the other source updates. App-wide variables work the same way: {{ env.my_key }}.

If an expression can't be evaluated in MQTT, WebSocket, or Default value, that fetch, subscribe, or tick is skipped; MQTT and WebSocket keep the last successful subscribe, and the source shows an error. If an HTTP action URL is empty or invalid after that, the rest of that list stops.

HTTP

An HTTP source has an Actions / Transformers pipe. Keep at least one enabled HTTP request. You can add more requests and optional Simple expression, JSONPath, Lua, JavaScript, Stop pipeline, or Debounce after them. HTTP sources do not have a separate transformer list — this list is fetch plus transform.

What you typically set:

On each HTTP request you set:

Each poll (and each Trigger data source(s)) runs linked data pieces and components again even if the response is the same.

Login in the address: when a server or camera asks for a user name and password, put them in the URL before the host: http://{{ env.camera_login }}@192.168.1.20/picture. Create an ENV variable camera_login with the value user:password, so the password does not appear in the URL. A Video source also has its own Username and Password fields (see Video).

Basic and Digest login both work. Digest can use MD5, SHA-256, or SHA-512-256, whichever the server asks for. If the password contains @, :, /, or #, write them as %40, %3A, %2F, and %23. This works the same for HTTP requests, HTTP streams, and Video sources.

The app remembers a Digest login, so the next poll, picture, or reconnect logs in straight away without an extra request. The login goes only to the server in the address, never to another server it redirects to. If you set an Authorization header yourself, that header is sent instead.

Tip: the very first request sends the password with Basic login. On a plain http:// address it can be read on your network, so use https:// when the camera or server supports it.

When later requests need earlier data: add several HTTP requests to the list — for example multi-step login (fetch a token, then call a protected API with it). Requests run in order on each fetch. Pull fields out of the first response with JSONPath or Lua, then use them in the next request's URL, headers, or body — for example Authorization: Bearer {{ value.access_token }}.

Run if skips that row when the condition is not met. Do not run if skips it when the condition is met. If the condition cannot be evaluated, that row is also skipped, and the list continues.

Stop pipeline if failed is on unless you turn it off. A server error, a timeout, or a lost connection then stops the rest of the list. The request still replaces ctx.transport, and ctx.error is set. Turn it off for site monitoring so a later script can still run.

A Simple expression / JSONPath / Lua error stops the rest of the list. An empty or invalid URL, or an expression that can't be evaluated, also stops the rest of the list.

What gets stored: text responses are stored as text (JSON-looking strings are decoded when possible). Image responses are stored as raw image data. Leftover ctx.error after the list marks the source as failed.

Request details: every HTTP request overwrites ctx.transport:

Hyphenated header names stay as map lookups, for example ctx.transport.responseHeaders["set-cookie"]. Use ctx.transport.responseTime ?? 0 in an expression, or return ctx.transport.responseTime or 0 in Lua, to show how long the request took on a Label.

HTTP stream

An HTTP stream stays connected and reads the response as it arrives. Each line, JSON value, or chunk becomes the source value, then source transformers run. Use it when the server keeps sending. Use HTTP when each refresh is a normal request that finishes.

What you typically set:

Connection on the source shows the state, the last close, and when the next try will happen. Reconnect now starts a fresh connection even when the current one looks healthy.

Use Keep connected to control whether the stream stays connected in the background:

Connect and Disconnect do not move this switch. They hold the live stream until you restart the app or flip the switch. The data source list then shows Connected by action or script or Disconnected by action or script.

Trigger data source(s) does not drop a working stream. It refreshes data pieces from the last received value. It connects only when the stream is down, blocked, or Keep connected is off.

With Keep connected on, a stream that ends connects again. With it off, a trigger opens one session and then waits. If the address or an expression cannot be evaluated, the source stays blocked until you fix it or trigger it. After some server errors, such as not found, the app waits the maximum delay unless On prepare can fetch a new address. A bad NDJSON line is reported and the stream stays open.

See Get started: HTTP stream.

Video

A Video source shows live video from a camera in a Video component. It reads an MJPEG stream over HTTP: the server keeps one response open and sends one JPEG picture after another. Many network cameras and phone webcam apps offer such an address.

This source has no value. Labels, transformers, and source_value("Name") do not see the pictures — only a Video component shows them. That is why it has no Default value and no transformers.

By default the source stays connected, whether or not a Video component shows it. Turn on Pause when not on screen to save network traffic and battery: the source then connects only while a Video component that uses it is on screen. When you leave that screen, or the app goes to the background, the stream closes about 2 seconds later. Several Video components on the same source share one connection.

What you typically set:

Keep connected:

With Pause when not on screen on, both work only while a Video component that uses this source is on screen.

Connection on the source shows the state and when the next try will happen. With Pause when not on screen on, the source editor covers the screen with the Video component, so the state turns to Idle after a moment. That is expected.

If nothing arrives for 15 seconds, the app connects again. If the address answers but no pictures arrive, the source shows an error: check that the address returns an MJPEG stream. After some server errors, such as not found or a refused login, the app waits the maximum delay. An empty or invalid address, or an expression that cannot be evaluated, stops the source until you fix it.

When the camera refuses the user name or password, the source shows Login refused. Check the user and password. (HTTP 401). When the camera asks for a login and none is set, it shows This address asks for a login. Enter the user and password. (HTTP 401).

Pictures are decoded on your device. A 720p stream at 30 frames per second is fine; for very large streams, such as 4K, choose a smaller size in the camera settings.

Camera snapshot address

Many cameras also have an address that returns one JPEG picture, the current view, for example http://192.168.1.20/ISAPI/Streaming/channels/102/picture on Hikvision. Use a Video source for it too, not an HTTP source.

The app sees that each answer ends after one picture and asks for the next one after Reconnect delay (ms). So Reconnect delay (ms) sets how often the picture updates: 500 gives about 2 pictures per second, and the lowest value, 100, up to 10 if the camera answers that fast. Connection stays green between pictures. Between pictures the app reuses the network connection when the camera allows it, and sends a Digest login straight away, so each picture takes one request.

Why not an HTTP source with an Image component? A Video source keeps only the newest picture and draws it straight away. An HTTP source runs every picture through its Actions / Transformers pipe and stores it as the source value, which is extra work at 2 pictures per second. Use an HTTP source only for a slow refresh, for example once every 30 seconds or less often, or when you need actions on the answer.

If the address starts sending a real MJPEG stream, the source switches to it by itself.

A camera that sends its pictures as MQTT or WebSocket messages needs no Video source: bind the Video component to that MQTT or WebSocket source (see MQTT).

MQTT

What you typically set:

Every message updates the source's value with just the message contents (text, decoded JSON, or an image). Details about the message itself are available separately as ctx.transport in transformers and tap actions:

Camera pictures as messages: some cameras, for example an ESP32-CAM, publish one picture per message. Show them with a Video component that uses this source: it draws only the newest picture. Each message must be the picture itself (PNG, JPEG, GIF, or WebP), not Base64 text. Other messages are ignored, and the last picture stays.

To publish outbound, use a tap MQTT send on the component, or a reusable data destination with Trigger data destination. An MQTT source only receives.

WebSocket

What you typically set:

Routix Dash tries Socket.IO first when it makes sense, and falls back to a plain WebSocket if that fails. SSE is chosen per connection with Transport.

Messages are handled the same way as MQTT: text, JSON, or an image is detected automatically for value. Details about the message itself — event name, mode (websocket, sse, or socket.io), connection URL, and on SSE a last-event id — are available as ctx.transport in transformers and tap actions.

Camera pictures sent as messages can be shown with a Video component, the same as for MQTT (see Camera pictures as messages under MQTT).

Timer

What you typically set:

Every tick notifies linked data pieces and components, even if the string didn't change (component transformers can still produce something different each time — for example, a random number or the current time). Empty Default value still ticks.

Manual mode stops the timer and does not emit an empty Default value on load; use Trigger data source(s), or the source's own trigger control, to emit one value at a time.

Each tick also sets ctx.transport: reason (interval, trigger, defaultValue, or peer), intervalMs, and receivedAt.

Shared connections

MQTT connections and WebSocket connections are set up separately from sources, and reused by multiple sources (and destinations). Routix Dash keeps a connection open for as long as anything still needs it. On those connection lists, swipe a row right to left to delete a connection.

Each MQTT and WebSocket/SSE connection also has Keep connected:

Connect and Disconnect do not move this switch. They hold the live link until you restart the app or flip the switch. The connection list then shows Connected by action or script or Disconnected by action or script.

MQTT and WebSocket/SSE connections can run On prepare actions (the first row under Events) before each connect, including reconnects. Use this when the host, URL, headers, query parameters, or credentials need fresh values each time.

Allowed actions: HTTP request, Simple expression, JSONPath, Lua, JavaScript, and Stop pipeline. The row's switch turns the list on or off. A list that is off, or has nothing enabled, is skipped.

MQTT and WebSocket/SSE connections can also run On connected actions (also under Events). They run after every successful connect, including reconnects, once the connection is up. Socket.IO rooms and MQTT topics are already subscribed again by then. Use them to log in, subscribe, send a hello message, or ask for the current state.

Host, URL, credentials, headers, and similar connection fields can include {{ env.my_key }}. Changing that variable reconnects interpolating connections. See ENV variables.

Each connection's editor shows a status dot and a Connection log. If there is an error, the log opens so you can see what went wrong.

The last setting in a connection editor is Data, the same as on a source.

Source list rows for HTTP stream, MQTT, and WebSocket/SSE show two dots side by side: connection, then activity. HTTP and Timer rows show one activity dot, and every name starts at the same offset. Each data piece still shows one status dot:

How data type is detected

For HTTP, MQTT, and WebSocket, Routix Dash looks at the content type and the bytes themselves to decide whether the data is text, JSON (decoded before transformers run, when possible), or an image. The stored value follows that decision, so match the components you add — for example, a Label for text or JSON.

Source transformers and status

HTTP stream, MQTT, WebSocket, and Timer sources can have their own transformers (JSONPath, Simple expression, Lua, JavaScript, Stop pipeline, Debounce) that run on every new incoming value before it's stored as value. HTTP sources use the Actions / Transformers pipe instead. A Video source has no transformers. See Data transformers.

Network failures run through this same chain. ctx.error is an object with a message, a kind, and sometimes a statusCode. It's null when things succeed, or after a Lua transformer clears it with ctx.error = nil. Clearing it on the source affects every transformer that runs after it, and every component linked to that source.

Each source keeps:

After the source's transformers run, each linked component gets its own copy of the error information. Whether a component shows a red #error above it in the editor depends on a transformer throw — leftover ctx.error stays available to later transformers in that component chain. Connection health is separate.

Incoming data is cached on your device, so restarting the app restores the last value before the next fetch or message arrives. If nothing is cached yet, Default value is used instead.

Refreshing by hand

While a tap action is running, automatic background refreshes for the tapped component's source pause, so every action sees a stable value.

See also