Expand description
A tag server on the ciplink core: one process per site owns the PLC connections and serves tag values to web
apps over a WebSocket (the protocol of ciplink-tagserver and @ciplink/react).
Re-exports§
pub use config::Config;pub use config::load_config;pub use server::ServerHandle;
Modules§
- cli
- The command line:
ciplink-server run | dump-tags | types | service. - codegen
- The
typessubcommand: a TypeScript module typing the tags of a running server (GET /tags), as a typed tag tree (tagTree<PLC1Tags>) or the 0.2 union of tag names. - config
- Reads the TOML config file (the same format as the Python ciplink-tagserver).
- hub
- The hub: subscriptions, fan-out, writes and momentary buttons. One task owns all of it and handles one message at a time (client messages, worker events, timers), so nothing here needs a lock.
- logging
- A small logger for the server: INFO and above, to stderr or to a file rotated at 10 MB with 5 kept.
- mock
- A fake driver for
--mock: serves the tags of the PLC’smock_tagsJSON file with simulated values. - planner
- Read planner: one read of a struct instead of several reads of its members, which are sliced out of it.
- plc
- The PLC side of the server: the driver calls it makes (
Plc, a real controller or the mock) and the controller structure it serves (Catalog). - rules
- Tag settings: decorators attached by UDT member or tag path, then the match-pattern rules and poll groups.
- server
- The HTTP side (WebSocket
/ws,GET /health,/stats,/tags) and the server that ties the hub and the PLC workers together. - service
- Runs the server at Windows startup as a Task Scheduler task (no extra software needed).
- values
- Turns driver results into JSON-ready cache entries, and JSON write values into driver values.
- worker
- One thread per PLC: owns the driver, polls the subscribed tags by tier and poll group, runs the queued writes.