Floating Server V2

FS2 Floating client – Method Documentation

checkConnection() -> Bool

Checks whether the FS2 server is reachable.

Description: Attempts to contact the FS2 backend and verifies that the server responds.

Returns:

  • true if the server is reachable

  • false if the connection fails

Use case: Call before authentication or license operations to ensure backend availability.


authenticateUser(user: String, password: String) throws

Authenticates a user against the FS2 server.

Parameters:

  • user – Username

  • password – User password

Throws:

  • Error if authentication fails (invalid credentials, network error, etc.)

Description: Establishes an authenticated session required for further license operations.


getAllLicenses() throws -> [License]

Fetches all licenses available to the authenticated user.

Returns:

  • Array of License objects

Throws:

  • Error if request fails or user is not authenticated

Description: Retrieves licenses assigned or accessible to the current user account.


register(userID: String, licenseId: License) throws -> License

Registers a license to a specific user.

Parameters:

  • userID – Identifier of the user

  • licenseId – License to register

Returns:

  • Updated License object (including features and metadata)

Throws:

  • Error if registration fails

Description: Associates a license with a user in the system and prepares it for usage.


syncConsumptions() throws

Synchronizes consumption data with the FS2 server.

Throws:

  • Error if synchronization fails

Description: Uploads local consumption usage to the backend and refreshes state from server.

Use case: Required when using metered or consumption-based licenses.


syncFeatureConsumption() throws

Synchronizes feature-level consumption with the backend.

Throws:

  • Error if synchronization fails

Description: Updates feature usage state between client and server.

Use case: Used when tracking feature-specific consumption metrics.


registerFloatingFeature(_ feature: Feature) throws

Registers (acquires) a floating feature.

Parameters:

  • feature – Feature to register

Throws:

  • Error if acquisition fails

Description: Locks a floating feature for use by the current user/session. Floating features typically have limited concurrent usage.


releaseFloatingFeature(_ feature: Feature) throws

Releases a previously registered floating feature.

Parameters:

  • feature – Feature to release

Throws:

  • Error if release fails

Description: Unlocks the floating feature and makes it available to other users.


borrow(userID: String, licenseId: License, until: Date) throws

Borrows a license until a specified date.

Parameters:

  • userID – Identifier of the user

  • licenseId – License to borrow

  • until – Expiration date of the borrow period

Throws:

  • Error if borrow operation fails

Description: Marks a license as borrowed for offline use until the given expiration date.

Use case: Allows temporary offline usage without continuous server connectivity.

Token Handling

Some license operations require an authentication token.

getToken() -> JwtToken?

Retrieves the JWT token from the authenticated FS2 user session.

Description: Returns the token issued during authentication. This token must be passed to license-level operations that communicate with the backend.

Example:

Note: If the token is nil, the user is not authenticated or the session has expired.


License-Level Methods (Token-Based)

These methods are called on a License instance and require a valid JwtToken for server communication.


fullCheck(env:isFloatingServerV2:token:)

Performs a complete license validation.

Parameters:

  • env – Environment identifier ("mac", "win", "linux", etc.)

  • isFloatingServerV2 – Indicates whether Floating Server V2 logic should be used

  • token – JWT token obtained from authenticated FS2 user

Throws:

  • Error if remote validation fails

  • Error if local validation fails

  • Error if token is missing for required remote validation

Description: Performs both:

  • Local validation (expiry, feature constraints, etc.)

  • Remote validation against LicenseSpring platform

Use case: Call before allowing protected functionality.


synchronize(env:isFloatingServerV2:token:)

Fetches fresh license state from the LicenseSpring platform.

Parameters:

  • env – Optional environment identifier

  • isFloatingServerV2 – Floating server version flag

  • token – JWT token

Throws:

  • Error if synchronization fails

  • Error if token is invalid or missing

Description: Updates the local license object with the latest server-side data.

Use case: Call periodically or before critical operations to ensure license state is current.


syncFeatureConsumption(code:token:)

Synchronizes consumption data for feature(s).

Parameters:

  • code – Specific feature code to sync. If nil, syncs all consumption features.

  • token – JWT token

Throws:

  • Error if sync fails

  • Error if token is missing

Description: Uploads local consumption usage for feature-based consumption licenses.

Note: Only meaningful for Consumption Features.


syncConsumptions(token:)

Synchronizes license-level consumption data with the backend.

Parameters:

  • token – JWT token

Throws:

  • Error if sync fails

Description: Updates total consumption state between client and server.

Note: Only meaningful for Consumption-based licenses.


registerFloatingFeature(_:token:)

Registers (acquires) a floating feature.

Parameters:

  • licenseFeature – Feature to acquire

  • token – JWT token

Throws:

  • Error if acquisition fails

  • Error if token is missing

Description: Locks a floating feature for the current user/session.

Use case: Used in floating license environments where concurrent feature usage is limited.


Token-Based Flow Example


Important Notes

  • JwtToken is required for any license operation that communicates with the backend.

  • Token is obtained via authenticated FS2 user session.

  • If token expires, re-authentication is required.

  • Floating and consumption operations depend on proper token propagation.

Last updated

Was this helpful?