Skip to content

Remote services

The Hive SDK provides a remote service that allows you to perform tasks that should originally be done on the app server remotely through the Hive console. The remote services provided in provisioning are as follows.

  • Remote Configuration
  • Remote Logging

Remote configuration

When operating an app, the app server URL may vary depending on the app version. Remote configuration is a feature that allows you to change the server URL settings remotely without accessing the app server. Developers can register server URL information in the Hive console and map and manage servers by app version.

Note

Remote configuration is a feature that allows you to remotely modify server settings that need to be changed on the app server through the Hive console, and currently only supports the ability to remotely modify the app server URL. Other remote configuration features will be added in the future.

The app server URL can be modified differently for each AppID, app version, and server. To use remote configuration, you must first register the server URL in the Hive console.

When you call Configuration.getMetaData from the app client, you can receive the server URL registered or modified in the Hive console as a String value. Here is an example code that calls the server URL.

API Reference: HiveConfiguration getMetaData

using hive;    
    // data key    
    String key = "game_server_url";    
    // Whether data is updated    
    Boolean forceReload = false;    
    // metadata call    
    Configuration.getMetaData(key, forceReload, (ResultAPI result, String value) => {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});

API Reference: Configuration:: getMetaData

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // data key    
    string key = "game_server_url";    
    // Whether data is updated    
    bool forceReload = false;    

    // 메타데이터 호출    
    Configuration::getMetaData(key, forceReload, [=](ResultAPI const & result, string value) {    
         if (result.isSuccess()) {    
             // 호출 성공    
         }    
});

API Reference: Configuration.getMetaData

import com.hive.Configuration;
import com.hive.ResultAPI;
// data key    
val key = "game_server_url"    
// Whether data is updated    
val forceReload = false    
// metadata call    
Configuration.getMetaData(key, forceReload, object : Configuration.GetMetaDataListener {    
        override fun onGetMetaData(result: ResultAPI, data: String) {    
            if (result.isSuccess) {    
                // call successful    
            }    
        }    
})

API Reference: Configuration.INSTANCE .getMetaData

import com.hive.Configuration;    
    import com.hive.ResultAPI;    
    // data key    
    String key = "game_server_url";    
    // Whether data is updated    
    boolean forceReload = false;    
    // metadata call    
    Configuration.INSTANCE.getMetaData(key, forceReload, (result, data) -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: ConfigurationInterface.getMetaData

import HIVEService    
    // data key    
    let key = "game_server_url"    
    // Whether data is updated    
    let forceReload = false;    

    // 메타데이터 호출    
    ConfigurationInterface.getMetaData(key, forceReload: forceReload) { result, value in    
         if result.isSuccess() {    
             // 호출 성공    
         }    
}

API Reference: HIVEConfiguration getMegaData

#import <HIVEService/HIVEService-Swift.h>    
    // data key    
    NSString *key = @"game_server_url";    
    // Whether data is updated    
    BOOL forceload = NO;    
    // metadata call    
    [HIVEConfiguration getMegaData: key forceReload: forceReload handler: ^(HIVEResultAPI *result, NSString *value) {    
    if ([result isSuccess]) {    
    // call successful    
    }    
}];
#include "HiveConfiguration.h"

// Data key
FString Key = TEXT("game_server_url");

// Data refresh status
bool bForceReload = false;

// Meta data call
FHiveConfiguration::GetMetaData(Key, bForceReload, FHiveConfigurationOnMetaDataDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FString& Value) {
        if (Result.IsSuccess()) {
                // Call successful
        }
}));

Using cached values

The Hive SDK reads the server URL previously entered in the Hive console during the initialization process and caches it for the app client. Therefore, to reduce network costs by using this cached value when you want to retrieve the previously entered value without changing the server URL in the Hive console, set forceReload to false when calling Configuration.getMetaData.

If you have modified the server URL in the Hive console and need to reflect this modified URL in the app, set forceReload to true when calling Configuration.getMetaData. This will delete the existing cached server URL in the app client and fetch the latest server URL from the Hive server. This calling pattern is generally used when the app is restarted.

Remote logging

Remote logging is a feature that allows logs that need to be collected from the app server to be collected remotely via the Hive SDK. By using remote logging, you can receive debug logs remotely. For example, if you register a specific app user in the Hive console, you can check the debug logs in a remote environment when issues related to this user occur, rather than on the app server.

When you specify a specific user to collect logs, the app logs and Hive logs accumulated when this user uses the app are collected and loaded into Google Cloud. Developers can receive the logs collected remotely to monitor and use for debugging. To use remote logging, you must first set up the user to collect logs in the Hive console.

How it works

The remote logging operation works as follows.


Target user settings

Users who can collect logs are those who have issued a DID after running the app at least once (i.e., the Hive SDK has been initialized at least once). However, if a crash or error occurred before initializing the Hive SDK during the app execution process, logs cannot be collected from this user.

Collecting logs

Enabling remote logging will collect Hive logs and app logs for the duration of log collection entered in the Hive console.

Warning

If you collect too many logs, resources may be concentrated on network traffic and log processing, which can affect app performance. It is recommended to minimize repetitive logs occurring within loops or to consolidate them into a single log for collection.


Hive log

Hive logs are logs that are collected by default within the Hive SDK code. They cannot be controlled by the app.

App log

App logs are logs obtained by inserting the Logger.log call provided by the Hive SDK into the app client code. You can choose the desired location in the app client code to collect the desired values. Insert code like the example below at the desired location.

API Reference: Logger.log

using hive;    
Logger.log("Enter logging contents");

API Reference: Logger::log

    #include <HIVE_SDK_Plugin/HIVE_CPP.h>    
        using namespace std;    
        using namespace hive;    
    Logger::log("Enter logging contents");

API Reference: Logger.i

import com.hive.Logger;    
Logger.INSTANCE.i("Enter logging contents");

API Reference: LogInterface.log

import HIVEBase    
LogInterface.log(sourceInfo: "Log source information (class, method name)", type: .Info, tag: "Log tag", msg: "Log message")

API Reference: Objective-C

#import <HIVEBase/HIVEBase-Swift.h>

[HIVELogger logWithSourceInfo:@"Log source information (class, method name)" type: LogTypeInfo tag: @"Log tag" msg: @"Log message"];
#include "HiveLogger.h"

FHiveLogger::Log(TEXT("Logging content input"));