Expand description
Getting let in, and staying that way – the one sequence every Signal K client goes through before it has anything else to do: find a server, connect if there is already a token, ask for one otherwise, wait for a human, and start over under a fresh token if the server ever takes an old one back.
Onboard is that sequence, factored out of a first client’s own
delta-feed module, where it was worked out and tested first. Two
applications built on Signal K do not differ in how any of this goes
– only in what they do
with a delta once one arrives, which stays each application’s own
Onboard::poll never sees a crate::stream::Event::Connected,
crate::stream::Event::Disconnected or
crate::stream::Event::Unauthorized leak out to a caller: this module
is exactly the place that already knows what each one means, and a
caller with its own copy of that knowledge is the duplication this
exists to end. Only [signalk::Delta] comes out the other side.
§What stays with the application
Where a device token lives on disk, what GSettings a mariner’s own
discovery preference is in, and how a raw address is resolved when
discovery is not used – none of that is here, the same “not this
crate’s job” boundary the rest of signalk-client already draws (see
its own module doc). Credentials is the seam: an application
implements four small file operations, and hands Onboard::seek a
closure for finding a server however it prefers to. Everything about
sequencing those into “connected, or why not” is what this module
does instead of every application working it out for itself again.
Structs§
- Onboard
- Finding a server, connecting to it, and staying let in.
Enums§
- Link
- How the socket itself is doing, apart from whether a human has
approved this device yet – see
Onboardingfor that half. - Onboarding
- Where this device stands on its way to a first delta.
- Stage
- Whether this run has ever gotten in.
Traits§
- Credentials
- What an application keeps on this desktop so
Onboarddoes not have to: a device token, the identity it asks under, and a request it is still waiting to hear back about. Implemented once per application – see the module’s own doc for why storage itself stays out of this crate.