DocsClientsClient lifecycle

Clients

A client is anything that connects to WBSKT: a board, a script, an app. This page covers its whole life, from the first time it starts to the day you remove it, and what the console shows along the way.

Statuses

Every client has one status. It decides whether the client can sign in.

StatusMeansCan connect
PendingIt joined through a policy that needs approval and is waiting for you.No, it keeps retrying until approved
RegisteredApproved. Counts towards the policy's and the plan's client limits.Yes
RejectedYou turned it down while it was pending.No
RevokedYou took away its access after approving it.No, and its connection is closed at once

You can move a client between any of these from its page, or from its policy's client list. Approving a revoked or rejected client brings it back with the same identity and history; it counts towards the limits again, so approval can be refused when a limit is full.

Online, offline and updating

A registered client also shows whether it is connected right now.

  • Online: it holds a connection. The header shows how long it has been up.
  • Offline: no connection. The client shows when it was last seen.
  • Updating: it closed its connection to install new firmware. For up to 5 minutes it shows as updating, not offline, and online and offline triggers wait. If it doesn't come back in that time it shows as offline. For now, the console shows an updating client as offline.

A board that loses power can't say goodbye. Its connection is noticed as gone when the keepalive stops being answered (see keepalive). If a whole WBSKT gateway stops answering, its clients are shown offline within about two minutes, so offline triggers still fire.

The client page

Open a client from Clients to see:

  • The header: name, status, uptime or last seen, its policy, the platform and library it reported, and its latest latency. Choose Ping to measure the round trip now. WBSKT also measures it on its own every 5 minutes.
  • Send command: a form built from the commands the client declared, or a raw JSON editor, and your templates. See Commands.
  • Activity: every message in and out, live, with older ones loading as you scroll up.
  • State: its state variables, with a small chart for numbers. See Capabilities, state and readings.

Names and tags

A client starts with the name it registered with. Rename it any time; the name is up to 100 characters, and workflows refer to the client by its ID, so a rename never breaks one.

Tags group clients across policies, like kitchen or battery. A client can have up to 10. They are stored in lower case, and the client list filters by tag.

For nowTags are in the API only (below); the console doesn't show or set them.

The client's secret

When a client first registers, WBSKT gives it an ID and a secret, which the library stores on the device and uses to sign in from then on. Rotate secret makes a new one and shows it once. The old secret stops working at once, and the client's connection is closed. Put the new secret on the device next to the same ID; the libraries don't register again on their own, so you won't get a duplicate client.

Removing a client

Revoke access keeps the client in the list and closes its connection, so you can bring it back later with Restore access. Delete client removes it with its capabilities and state, closes its connection and stops its secret working. Commands waiting for it fail, saying it was deleted. Its past messages stay in the audit log.

A deleted client can only come back by registering again with a PIN, as a new client. Its library has to forget its stored ID and secret first; each SDK's page says how.

What happens when…

Two boards use the same ID and secret
Each connection ends the one before it, so they knock each other off. After 5 of these in 10 minutes the audit log warns that the credentials look shared, at most once every 10 minutes. Give each board its own registration.
I revoke a client that is connected
Its connection closes within a moment and it can't sign in again. The library logs the refusal and keeps retrying on its reconnect schedule, so approving it later brings it straight back.
A client is deleted, then starts again with its old credentials
Sign-in is refused with CLIENT_UNAUTHORIZED. The libraries stop and report it rather than registering again. Clear the stored credentials to enrol it as a new client.
A client's clock is wrong
Messages carry the time the client made them. A state report stamped in the future is treated as made when it arrived, so a fast clock can't hold back newer values.
A client was offline and sends a backlog
Messages more than 30 seconds old when they arrive are marked late. Workflows can tell late readings from live ones, and charts place them at the time they were taken.
The account is frozen by WBSKT support
Every pending and registered client is revoked and disconnected, and no new client can enrol (ACCOUNT_FROZEN). Lifting the freeze doesn't approve them again; you do that.
In depth

Rules and API

Endpoints

Under /api/v1/workspaces/{workspaceRef}/clients. Reading needs clients.read. Renaming, tagging and changing status need clients.update; deleting and rotating the secret need clients.manage; ping needs clients.ping.

CallDoes
GET /Lists clients. Filters: status (repeatable), name, tag, policyRefId. Paged, with totalCount.
GET counts{ total, pending, registered, revoked, rejected, connected }, for the workspace or one policy.
GET tagsEvery tag in use with its client count.
GET /{clientRef}Detail: presence, uptime, latency, SDK, capabilities, system, firmwareVersion, updatingUntil, lastSeenAt.
PATCH /{clientRef}{ name?, status? }. The status changes first, so a refused status leaves the name unchanged.
PATCH statusUp to 100 clients to one status. Answers updated and failed per client; approvals are taken in the order given.
PUT /{clientRef}/tagsReplaces the tags.
POST /{clientRef}/rotate-secretReturns { clientRefId, secret } once.
POST /{clientRef}/pingMeasures latency now. A ping is never queued.
DELETE /{clientRef}Deletes the client.

The status values on the wire are 0 Pending, 1 Registered, 2 Revoked, 3 Rejected.

Errors

CodeStatusWhen
CLIENT_NAME_INVALID400A name blank or over 100 characters once trimmed.
CLIENT_STATUS_INVALID400A status other than the four above.
CLIENT_UPDATE_EMPTY400A change naming neither field.
CLIENT_TAG_INVALID400A tag that isn't 1 to 32 letters, digits, spaces, -, _ or ., starting and ending with a letter or digit.
CLIENT_TAGS_TOO_MANY400More than 10 tags.
POLICY_LIMIT_REACHED400Approving into a full policy.
CLIENT_NOT_FOUND404No such client in this workspace. Another workspace's client reads the same.
CLIENT_OFFLINE409Pinging a client with no connection.
PLAN_CLIENT_LIMIT_REACHED409Approving past the plan's client limit.

Presence, exactly

  • Presence is a lease. Each gateway sends a heartbeat; a gateway silent for 120 seconds has its clients marked offline by a sweep that runs every 60 seconds, each with a disconnect event, so offline triggers fire.
  • One client has one connection. A second connection supersedes the first, which is closed with the superseded close code.
  • A client that closes with the updating close code (4000 on WebSocket) gets updatingUntil 5 minutes ahead. Its next connect clears it.
  • Latency is a sys.ping and sys.pong round trip timed on the server's clock, sampled every 5 minutes per client and on demand.
  • lastSeenAt is the last connect or disconnect, or the moment the sweep found its gateway gone.
  • Revoking, deleting or rotating a secret refuses every token issued before it, so a client can't keep a session it lost the right to.