Expand description
A PV Web Socket server in the dialect of https://github.com/ornl-epics/pvws.
Clients send subscribe, clear, write, list and echo messages and
get one update per changed PV: full metadata first, then only what
changed. Like PVWS, an update with neither value nor text means the PV
is not connected.
StructsΒ§
- Changed π
- The PVs that changed since a client last heard, and a wake-up for it.
- Client
Slot π - Counts a connected client until dropped.
- Config
- Hub
- What every client connection shares.
- Pace π
- Paces a clientβs new subscriptions: each spends a token, and tokens
come back at
SUBSCRIBE_RATEa second up toSUBSCRIBE_BURST. - Sub π
- SubSlot π
- Subs π
- One clientβs subscriptions.
ConstantsΒ§
- MAX_
CLIENTS π - The most clients connected at once.
- MAX_
MESSAGE π - The largest message a client may send.
- MAX_
NAME π - The longest PV name accepted.
- MAX_PVS π
- The most PVs one client may subscribe to.
- MAX_
TOTAL_ πPVS - The most PVs all clients together may subscribe to.
- SEND_
TIMEOUT π - The longest one message to a client may take to send before the client is dropped.
- SUBSCRIBE_
BURST π - New PVs one client may subscribe to at once β¦
- SUBSCRIBE_
RATE π - β¦ and each second after that: more are delayed, not refused.
FunctionsΒ§
- browser_
allowed π - Whether a request comes from a page of this server or an allowed
origin, by a name of this server; a request without an
Originis not from a browser page. - client_
key π - The address clients are counted by: an IPv4 address (also when mapped into IPv6), or the /64 network of an IPv6 one, as one machine may hold all of a /64.
- encode_
value π - error π
- fits_
i32 π - handle π
- Act on one client message, returning any replies.
- host_
allowed π - Whether browsers may call this server
host(lowercase, no port). - host_
name π - The host of a
host[:port], keeping the brackets of an IPv6 address. - info
- machine_
names π - This machineβs names: as the kernel and /etc/hostname have them, each without its domain, and in each domain of /etc/resolv.conf.
- names_
of π - Every name of a machine called
hostnamesindomains: exact names only, sows01.evil.comis notws01.site.org. - new_
names π - How many PVs a message subscribes to that the client does not have.
- normalise_
origin π - An origin in one spelling: lowercase, no trailing
/, no default port. - number π
- A double as PVWS sends it: non-finite values as text.
- resolv_
domains π - The domains of a resolv.conf: its
domainandsearchlines. - same_
range π - Whether two limit pairs are equal, with NaN equal to NaN (unset alarm limits are NaN, which would otherwise be sent on every update).
- same_
value π - Whether two values are equal, without comparing arrays that are the same allocation element by element, and with NaN equal to NaN.
- send π
- Send one message, giving up on a client that takes too long to take it.
- send_
all π - send_
updates π - Tell the client about every PV that changed since it last heard.
- serve π
- served_
scheme π - Whether a client may have
namefrom this server: notloc://PVs, which would live here for ever and be shared by every client, norsim://ones, which cost the server for nothing, nor formulas, which could read the serverβsloc://PVs. A page makes all three itself. - severity π
- socket
- strip_
default_ πport - token_
ok π - Whether
givenis the write token, without stopping at the first difference. - update π
- The
updatemessage taking a client fromlasttos, if anything it would see changed. - updates π
- The updates for the PVs that changed since the client last heard.
- valid_
name π - Whether
nameis a plausible PV name: not too long, and only printable ASCII with no spaces. - vtype π
- write_
error π - An error naming the PV a write was refused for, so the page can show it by the PV as well as log it.
- write_
text π - A written value as the text
Pv::writetakes; whole numbers lose their.0so integer PVs accept them.