Skip to content

Commit ba5fe27

Browse files
Updated from pipeline, Version : 23.1.4
1 parent 6f994be commit ba5fe27

File tree

8 files changed

+151
-13
lines changed

8 files changed

+151
-13
lines changed

.variables

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export LEVEL=CRITICAL
22
export REPO_NAME=justice-unreal-sdk-plugin
3-
export WORKDIR=/tmp/pipelines/4323564601/874313607/
4-
export COMMIT_HASH=3c26f22d5ea2d3bc15f8f8a7e3e8e9792e7e46b0
5-
export GIT_HASH=3c26f22d5ea2d3bc15f8f8a7e3e8e9792e7e46b0
6-
export VERSION=23.1.3
7-
export REVISION_ID=23.1.3
3+
export WORKDIR=/tmp/pipelines/4355976397/879798516/
4+
export COMMIT_HASH=654e9e506c90e3375e6430c4dee8425de7aa1064
5+
export GIT_HASH=654e9e506c90e3375e6430c4dee8425de7aa1064
6+
export VERSION=23.1.4
7+
export REVISION_ID=23.1.4
88
9-
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDIzLjEuMyAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2lucwo='
9+
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDIzLjEuNCAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2lucwo='

AccelByteUe4Sdk.uplugin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
3-
"Version": 34,
4-
"VersionName": "23.1.3",
3+
"Version": 35,
4+
"VersionName": "23.1.4",
55
"FriendlyName": "AccelByte Unreal Engine SDK",
66
"Description": "Official AccelByte SDK for Unreal Engine 4",
77
"Category": "Online Platform",

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [23.1.4](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/23.1.4%0D23.1.3) (2023-05-26)
6+
7+
8+
### Features
9+
10+
* **DS:** add DSM heartbeat API ([eb71bc8](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/eb71bc8160d9c1a5a1f64a71a88de2c4b234903b))
11+
512
### [23.1.3](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/23.1.3%0D23.1.2) (2023-05-22)
613

714
### [23.1.2](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/23.1.2%0D23.1.1) (2023-05-17)

Content/CompatibilityMap.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
"maxVersion": "1.18.1"
4545
},
4646
"lobby": {
47-
"minVersion": "3.19.0",
48-
"maxVersion": "3.19.0"
47+
"minVersion": "3.20.0",
48+
"maxVersion": "3.20.0"
4949
},
5050
"dsmcontroller": {
51-
"minVersion": "6.3.0",
52-
"maxVersion": "6.3.0"
51+
"minVersion": "6.3.2",
52+
"maxVersion": "6.3.2"
5353
},
5454
"game-telemetry": {
5555
"minVersion": "1.17.2",

Source/AccelByteUe4Sdk/Private/GameServerApi/AccelByteServerDSMApi.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,49 @@ void ServerDSM::GetServerInfo(const THandler<FAccelByteModelsServerInfo>& OnSucc
282282
}
283283
}
284284

285+
void ServerDSM::GetSessionTimeout(const THandler<FAccelByteModelsServerTimeoutResponse>& OnSuccess, const FErrorHandler& OnError)
286+
{
287+
FReport::Log(FString(__FUNCTION__));
288+
289+
if (ServerType == EServerType::NONE)
290+
{
291+
OnError.ExecuteIfBound((int32)ErrorCodes::StatusBadRequest, TEXT("Server not Registered."));
292+
return;
293+
}
294+
295+
const FString Url = FString::Printf(TEXT("%s/namespaces/%s/servers/%s/config/sessiontimeout")
296+
, *ServerSettingsRef.DSMControllerServerUrl
297+
, *ServerCredentialsRef.GetClientNamespace()
298+
, *ServerName);
299+
300+
HttpClient.ApiRequest(TEXT("GET"), Url, {}, FString(), OnSuccess, OnError);
301+
302+
}
303+
304+
void ServerDSM::ServerHeartbeat(const FVoidHandler& OnSuccess, const FErrorHandler& OnError)
305+
{
306+
FReport::Log(FString(__FUNCTION__));
307+
308+
if (ServerType == EServerType::NONE)
309+
{
310+
OnError.ExecuteIfBound((int32)ErrorCodes::StatusBadRequest, TEXT("Server not Registered."));
311+
return;
312+
}
313+
314+
const FString Url = FString::Printf(TEXT("%s/namespaces/%s/servers/heartbeat")
315+
, *ServerSettingsRef.DSMControllerServerUrl
316+
, *ServerCredentialsRef.GetClientNamespace());
317+
318+
FString Content = TEXT("");
319+
TSharedPtr<FJsonObject> JsonObject = MakeShared<FJsonObject>();
320+
JsonObject->SetStringField("podName", ServerName);
321+
TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&Content);
322+
FJsonSerializer::Serialize(JsonObject.ToSharedRef(), Writer);
323+
324+
HttpClient.ApiRequest(TEXT("PUT"), Url, {}, Content, OnSuccess, OnError);
325+
326+
}
327+
285328
void ServerDSM::GetSessionId(const THandler<FAccelByteModelsServerSessionResponse>& OnSuccess
286329
, const FErrorHandler& OnError)
287330
{
@@ -338,6 +381,13 @@ bool ServerDSM::ShutdownTick(float DeltaTime)
338381
return true;
339382
}
340383

384+
bool ServerDSM::PeriodicHeartbeat(float DeltaTime)
385+
{
386+
FReport::Log(FString(__FUNCTION__));
387+
ServerHeartbeat(OnHeartbeatSuccess, OnHeartbeatError);
388+
return true;
389+
}
390+
341391
void ServerDSM::ConfigureAutoShutdown(uint32 TickSeconds
342392
, int CountdownStart)
343393
{
@@ -395,6 +445,28 @@ void ServerDSM::ParseCommandParam()
395445
}
396446
}
397447

448+
void ServerDSM::SetOnHeartbeatSuccessDelegate(const FVoidHandler& OnSuccess)
449+
{
450+
OnHeartbeatSuccess = OnSuccess;
451+
}
452+
453+
void ServerDSM::SetOnHeartbeatErrorDelegate(const FErrorHandler& OnError)
454+
{
455+
OnHeartbeatError = OnError;
456+
}
457+
458+
void ServerDSM::StartHeartbeat(uint32 IntervalSeconds)
459+
{
460+
HeartbeatTickSeconds = IntervalSeconds;
461+
HeartbeatDelegate = FTickerDelegate::CreateRaw(this, &ServerDSM::PeriodicHeartbeat);
462+
HeartbeatDelegateHandle = FTickerAlias::GetCoreTicker().AddTicker(HeartbeatDelegate, HeartbeatTickSeconds);
463+
}
464+
465+
void ServerDSM::StopHeartbeat()
466+
{
467+
FTickerAlias::GetCoreTicker().RemoveTicker(HeartbeatDelegateHandle);
468+
}
469+
398470
int32 ServerDSM::GetPlayerNum()
399471
{
400472
UGameEngine* GameEngine = CastChecked<UGameEngine>(GEngine);

Source/AccelByteUe4Sdk/Public/GameServerApi/AccelByteServerDSMApi.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,24 @@ class ACCELBYTEUE4SDK_API ServerDSM : public FServerApiBase
152152
void GetServerInfo(const THandler<FAccelByteModelsServerInfo>& OnSuccess
153153
, const FErrorHandler& OnError);
154154

155+
/**
156+
* @brief GetServerTimeout
157+
*
158+
* @param OnSuccess This will be called when the operation succeeded.
159+
* @param OnError This will be called when the operation failed.
160+
*/
161+
void GetSessionTimeout(const THandler<FAccelByteModelsServerTimeoutResponse>& OnSuccess
162+
, const FErrorHandler& OnError);
163+
164+
/**
165+
* @brief ServerHeartbeat
166+
*
167+
* @param OnSuccess This will be called when the operation succeeded.
168+
* @param OnError This will be called when the operation failed.
169+
*/
170+
void ServerHeartbeat(const FVoidHandler& OnSuccess
171+
, const FErrorHandler& OnError);
172+
155173
/**
156174
* @brief Configure automatic shutdown, server will send shutdown request to DSM when there is no player on the DS for some periodical time after the DS is claimed. Must be called before calling RegisterServerToDSM or RegisterLocalServerToDSM
157175
*
@@ -175,6 +193,32 @@ class ACCELBYTEUE4SDK_API ServerDSM : public FServerApiBase
175193
*/
176194
void SetOnAutoShutdownErrorDelegate(const FErrorHandler& OnError);
177195

196+
/**
197+
* @brief Set handler delegate for OnHeartbeatSuccess event
198+
*
199+
* @param OnHeartbeatSuccess This delegate will be called if the DS heartbeat is sent
200+
*/
201+
void SetOnHeartbeatSuccessDelegate(const FVoidHandler& OnHeartbeatSuccess);
202+
203+
/**
204+
* @brief Set handler delegate for OnHeartbeatError event
205+
*
206+
* @param OnHeartbeatError This delegate will be called if the DS heartbeat is not sent
207+
*/
208+
void SetOnHeartbeatErrorDelegate(const FErrorHandler& OnHeartbeatError);
209+
210+
/**
211+
* @brief Start sending heartbeat at interval.
212+
*
213+
* @param IntervalSeconds
214+
*/
215+
void StartHeartbeat(uint32 IntervalSeconds);
216+
217+
/**
218+
* @brief Stop Heartbeat.
219+
*/
220+
void StopHeartbeat();
221+
178222
void SetServerName(const FString Name) { ServerName = Name; };
179223
void SetServerType(EServerType Type) { ServerType = Type; };
180224
int32 GetPlayerNum();
@@ -194,6 +238,7 @@ class ACCELBYTEUE4SDK_API ServerDSM : public FServerApiBase
194238
ServerDSM& operator=(ServerDSM &&) = delete; // Move assignment operator
195239

196240
bool ShutdownTick(float DeltaTime);
241+
bool PeriodicHeartbeat(float DeltaTime);
197242

198243
FString ServerName = TEXT("");
199244
FString Provider = TEXT("");
@@ -202,13 +247,18 @@ class ACCELBYTEUE4SDK_API ServerDSM : public FServerApiBase
202247
EServerType ServerType = EServerType::NONE;
203248
FHttpRequestCompleteDelegate OnRegisterResponse;
204249
FVoidHandler OnAutoShutdown;
250+
FVoidHandler OnHeartbeatSuccess;
205251
bool bIsDSClaimed = false;
206252
uint32 ShutdownTickSeconds = 0;
253+
uint32 HeartbeatTickSeconds = 0;
207254
int ShutdownCountdown = 0;
208255
int CountdownTimeStart = -1;
209256
FErrorHandler OnAutoShutdownError;
257+
FErrorHandler OnHeartbeatError;
210258
FTickerDelegate AutoShutdownDelegate;
259+
FTickerDelegate HeartbeatDelegate;
211260
FDelegateHandleAlias AutoShutdownDelegateHandle;
261+
FDelegateHandleAlias HeartbeatDelegateHandle;
212262
THandler<FAccelByteModelsPubIp> GetPubIpDelegate;
213263
FAccelByteModelsServerInfo RegisteredServerInfo;
214264
};

Source/AccelByteUe4Sdk/Public/Models/AccelByteDSMModels.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ struct ACCELBYTEUE4SDK_API FAccelByteModelsServerSessionResponse
205205
FString Session_id{};
206206
};
207207

208+
USTRUCT(BlueprintType)
209+
struct ACCELBYTEUE4SDK_API FAccelByteModelsServerTimeoutResponse
210+
{
211+
GENERATED_BODY()
212+
213+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AccelByte | Server | DSM | Models | ServerTimeoutResponse")
214+
int32 Session_timeout{};
215+
};
216+
208217
USTRUCT(BlueprintType)
209218
struct ACCELBYTEUE4SDK_API FAccelByteModelsServerCreateSessionRequest
210219
{

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "23.1.3"
2+
"version": "23.1.4"
33
}

0 commit comments

Comments
 (0)