SettingClient
Namespace: Daisi.SDK.Clients.V1.Host
This is a client that was built to interact with Hosts. There are a few things to remember when using this client:
- Host machines vary in speed and overall performance. Hosting your own machines and using your own network is the best way to ensure consistency.
- Every interaction with a Host requires an Orc approved session and a client key that has been granted acccess to the Host via the session.
- This client will automatically determine the fastest way to connect to the designated Host (Direct Connect (DC) or Fully Orchestrated Connect (FOC)), unless you override that feature.
- This client should be closed using
client.SessionManager.Close()after you are done using it so that the session doesn't expire. Multiple unclosed sessions will knock your network rating.
Factory
// Create the factory var factory = new SettingsClientFactory(); var hostId = "host-XXXX"; // Create the client var settingsClient = factory.Create(hostId);
NOTE: that you can only interact with local Host settings if you have the HostID.
Other Create overloads for this client will throw an exception.
Properties
SettingsSessionManagerSessionManagerget
Handles setting up and maintaining the Session.
Methods
GetAllSettingsResponseGetAll()
Gets all of the settings that are local to the Host. These are the settings that are located in the daisi-settings.json file in the host's main folder.AsyncUnaryCall<GetAllSettingsResponse>GetAllAsync()
Gets all of the settings that are local to the Host. These are the settings that are located in the daisi-settings.json file in the host's main folder.SetAllSettingsResponseSetAll(SetAllSettingsRequest)
Sets all of the settings local to the Host.AsyncUnaryCall<SetAllSettingsResponse>SetAllAsync(SetAllSettingsRequest)
Sets all of the settings local to the Host.
SettingClient Usage
Example for SettingsClient:
// You must know the Orc designated ID to use the SettingsClient
string hostId = "host-XXXX";
// Create the Factory
var settingsClientFactory = new SettingsClientFactory();
// Create the client
var settingsClient = settingsClientFactory.Create(hostId);
// Use settingClient to manage settings
var getAllResponse = settingsClient.GetAll();
var settings = getAllResponse.Settings;
// Get/Set settings as needed
var setAllRequest = new SetAllSettingsRequest()
{
Settings = settings
};
var setAllResponse = settingsClient.SetAll(setAllRequest);
Using SettingClient with Dependency Injection
Example in a Blazor component:
@inject Daisi.SDK.Clients.V1.Host.SettingsClientFactory SettingsFactory
@code {
private Daisi.SDK.Clients.V1.Host.SettingsClient settingsClient;
protected override void OnInitialized()
{
// Replace with your real Host ID.
string hostId = "host-XXX";
settingsClient = SettingsFactory.Create(hostId);
// Use settingClient to manage settings
}
}