Skip to content

Commit

Permalink
Updated from pipeline, Version : 24.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AccelByte-Build committed Jan 18, 2024
1 parent 2811e25 commit 35bbb5e
Show file tree
Hide file tree
Showing 44 changed files with 1,636 additions and 145 deletions.
12 changes: 6 additions & 6 deletions .variables
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export DO_UPDATE=true
export LEVEL=CRITICAL
export REPO_NAME=justice-unreal-sdk-plugin
export WORKDIR=/tmp/pipelines/5888353360/1131404518/
export COMMIT_HASH=77434b9b307a224a36541d2ee16d1f7907c977dd
export GIT_HASH=77434b9b307a224a36541d2ee16d1f7907c977dd
export VERSION=24.8.0
export REVISION_ID=24.8.0
export WORKDIR=/tmp/pipelines/5959756919/1143144526/
export COMMIT_HASH=b2a68124d03687644135edcc97e26a864d743bf4
export GIT_HASH=b2a68124d03687644135edcc97e26a864d743bf4
export VERSION=24.9.0
export REVISION_ID=24.9.0
export [email protected]
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDI0LjguMCAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2luc2Fnc1ZlcnNpb246IjMuNjQuMCIKCg=='
export COMMIT_MESSAGE_BASE64='Y2hvcmUocmVsZWFzZSk6IDI0LjkuMCAtIGNvbW1pdGVkIGFuZCB0YWdnZWQgYnkgSmVua2luc2Fnc1ZlcnNpb246IjMuNjUuMCIKCg=='
4 changes: 2 additions & 2 deletions AccelByteUe4Sdk.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 54,
"VersionName": "24.8.0",
"Version": 55,
"VersionName": "24.9.0",
"FriendlyName": "AccelByte Unreal Engine SDK",
"Description": "Official AccelByte SDK for Unreal Engine 4",
"Category": "Online Platform",
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@

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.

## [24.9.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/24.9.0%0D24.8.0) (2024-01-18)


### Features

* add messaging system for communicating between api and automatically send user region on lobby connected ([db2e764](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/db2e7648a8e721956fe9718824afffebf0939407))
* **HTTP:** automatically retry the request if the backend returns 429 response (too many request) ([1e98a05](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/1e98a05213e45d1bc616681b55809fd626fdb475))
* implement message envelope in lobby ([57a9360](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/57a9360c363a26f92da7ddb15e52d82f1e64fe31))
* Implement network conditioner in chat and lobby apis ([c336c73](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/c336c73db64a68509d21aba10b444a1039d96790))
* Implement NetworkConditioner class ([f7f6763](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/f7f6763f1c21c8858bf46c896d86532c0c9c647e))
* **Login:** simultaneous login IAM function ([e660235](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/e6602356fc3f67ca149c1fd2f279f9c7cb5cfe68))
* sdk adjustment to support returning explicit 3rd party platform info ([1eec4a7](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/1eec4a7e2e6e38ce8c70e5f7b0383974e594359a))
* send new access token to chat every auth token set and remove chat refresh token handlers ([442eacb](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/442eacb3858eeebd07dced8a56ca52b9bbceb0e5))
* send new auth token to lobby every time it's set ([6543d70](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/6543d70889789ff829481e94ce276a0471d080ac))
* **session:** Session Service Player Validation ([649240c](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/649240cde4b227762a6dbbedbecb5abab3e270f3))
* **session:** Session Service Player Validation ([294135f](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/294135f8fd828282b97ac47a2f264953d9f59446))
* SHA1 generator, update and set to lower case by default ([06ebd3d](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/06ebd3d756594316256fd5fbb450b372fa114fe7))


### Bug Fixes

* add missing include header in AccelByteChatApi.cpp ([327b293](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/327b293a9ec9bb7e45f3dff9531c012eef0c5689))
* add more description on platform user id ([2bfd454](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/2bfd45498e40e8a5c90adcec646a3f99c23f3d1f))
* add platform user id on login refresh token to cached when try to re-login ([e9d8aac](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/e9d8aac598e881537bef2bb9e2a98f48695d1318))
* change queue to shared pointer and add delay in PingRegionsSetLatencies to avoid intermittent enqueue error in messaging system ([0fcf7ff](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/0fcf7ffcaeef1f59a10e4b3bdf9a5e807a8348c8))
* change the parameter of platform user id position ([1ad5cec](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/1ad5cec3897bcb494166e8dce1cfbcbe68dcd4fa))
* **DeviceID:** Device ID randomizer not completely random due to uninitialize seed number ([c1f12dc](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/c1f12dcca90993c28761dae17e44e3e7905eb9f8))
* fix LogPython same name warning ([440ecef](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/440ecefb251419166d93f78562a0657c2716e5d8))
* GEngine check cause compile errors in UE 5.2 ([f770158](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/f770158d04ab810c848bdab90e8b922677ff753c))
* redo removing logphyton warning on editor startup ([0d39604](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/0d396046f4ffb96a2ebfa8a419e40150c30f6a40))
* remove ApiClient Credentials intializer ([3830167](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/3830167f781297443e1e67f35e515cfc4b98ecaf))
* remove the new function and add new platform user id optional parameter on the existing function ([b36074b](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/b36074b9203e0083cad382dca9d1cd7651b92b45))
* separate SendQosLatenciesMessage from UdpPing success delegate ([6504a92](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/6504a92b97ba3049ffb68c23094c943483d6ad26))
* **utility:** ambiguous FMath::Pow ([60af48e](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/60af48e93a10d01bfe52b5b42616522123cc72cd))


### Refactors

* remove lobby token refresh handlers ([9adb80a](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/9adb80afa4348d66b60a3eed056ce041a5b06d11))

## [24.8.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/24.8.0%0D24.7.1) (2024-01-09)


Expand Down
102 changes: 39 additions & 63 deletions Source/AccelByteUe4Sdk/Private/Api/AccelByteChatApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

#include "Api/AccelByteChatApi.h"

#include "Core/AccelByteMessageParser.h"
#include "Core/AccelByteRegistry.h"
#include "Core/AccelByteReport.h"
#include "Core/AccelByteSettings.h"
#include "Engine/Engine.h"
#include "Core/IWebSocketFactory.h"
#include "Core/FUnrealWebSocketFactory.h"
#include "EngineMinimal.h"

DECLARE_LOG_CATEGORY_EXTERN(LogAccelByteChat, Log, All);
DEFINE_LOG_CATEGORY(LogAccelByteChat);
Expand Down Expand Up @@ -395,13 +396,17 @@ namespace AccelByte
Chat::Chat(Credentials& InCredentialsRef
, Settings const& InSettingsRef
, FHttpRetryScheduler& InHttpRef
, FAccelByteMessagingSystem& InMessagingSystemRef
, FAccelByteNetworkConditioner& InNetworkConditionerRef
, float PingDelay
, float InitialBackoffDelay
, float MaxBackoffDelay
, float TotalTimeout
, TSharedPtr<IWebSocket> WebSocket)
: FApiBase(InCredentialsRef, InSettingsRef, InHttpRef)
, ChatCredentialsRef{InCredentialsRef}
, MessagingSystem{InMessagingSystemRef}
, NetworkConditioner{InNetworkConditionerRef}
, PingDelay{PingDelay}
, InitialBackoffDelay{InitialBackoffDelay}
, MaxBackoffDelay{MaxBackoffDelay}
Expand Down Expand Up @@ -461,13 +466,13 @@ namespace AccelByte
void Chat::Disconnect()
{
FReport::Log(FString(__FUNCTION__));
ChatCredentialsRef.OnTokenRefreshed().Remove(TokenRefreshDelegateHandle);
MessagingSystem.UnsubscribeFromTopic(EAccelByteMessagingTopic::AuthTokenSet, AuthTokenSetDelegateHandle);
if (WebSocket.IsValid())
{
WebSocket->Disconnect();
}

if (GEngine) UE_LOG(LogAccelByteChat, Log, TEXT("Disconnected"));
UE_LOG(LogAccelByteChat, Log, TEXT("Disconnected"));
}

bool Chat::IsConnected() const
Expand All @@ -488,17 +493,15 @@ namespace AccelByte
void Chat::OnConnected()
{
UE_LOG(LogAccelByteChat, Log, TEXT("Connected"));
TokenRefreshDelegateHandle = ChatCredentialsRef.OnTokenRefreshed().AddLambda([this](bool bSuccess)
{
if (bSuccess)
{
RefreshToken(CredentialsRef.GetAccessToken(), RefreshTokenResponse);
}
else

AuthTokenSetDelegateHandle = MessagingSystem.SubscribeToTopic(EAccelByteMessagingTopic::AuthTokenSet, FOnMessagingSystemReceivedMessage::CreateLambda(
[this](const FString& Message)
{
Disconnect();
}
});
FOauth2Token Token;
FJsonObjectConverter::JsonObjectStringToUStruct(Message, &Token);
RefreshToken(Token.Access_token, RefreshTokenResponse);
}));

ConnectSuccess.ExecuteIfBound();
}

Expand All @@ -514,20 +517,31 @@ namespace AccelByte
{
// disconnect only if status code > 4000 and we don't receive a login ban,
// other ban will try to reconnect the websocket
bool bIsReconnecting {true};
if (StatusCode > 4000 && !(bBanNotifReceived && BanType != EBanType::LOGIN))
{
bIsReconnecting = false;
Disconnect();
}
else
{
WebSocket->Reconnect();
}

MessagingSystem.UnsubscribeFromTopic(EAccelByteMessagingTopic::AuthTokenSet, AuthTokenSetDelegateHandle);

bBanNotifReceived = false;
BanType = EBanType::EMPTY;

UE_LOG(LogAccelByteChat, Log, TEXT("Connection closed. Status code: %d Reason: %s Clean: %d"), StatusCode, *Reason, WasClean);
ConnectionClosed.ExecuteIfBound(StatusCode, Reason, WasClean);
if(bIsReconnecting)
{
Reconnecting.ExecuteIfBound(StatusCode, Reason, WasClean);
}
else
{
ConnectionClosed.ExecuteIfBound(StatusCode, Reason, WasClean);
}
}

#pragma endregion // CONNECTION
Expand Down Expand Up @@ -695,51 +709,6 @@ namespace AccelByte

#define MODEL_RESPONSE(MessageType) FAccelByteModelsChat ## MessageType ## Response
#define CASE_RESPONSE_ID(MessageType) CASE_RESPONSE_ID_EXPLICIT_MODEL(MessageType, MODEL_RESPONSE(MessageType))

void Chat::ProcessFragmentedMessage(const FString& InMessage
, const FString& InEnvelopeStart
, const FString& InEnvelopeEnd
, FString& InOutEnvelopeBuffer
, FString& OutMessage
, bool& OutIsMessageEnd)
{
OutMessage = "";
if(!InEnvelopeStart.IsEmpty() || !InEnvelopeStart.IsEmpty())
{
FString MessageCopy {InMessage};
if(!InEnvelopeStart.IsEmpty() && MessageCopy.StartsWith(InEnvelopeStart))
{
InOutEnvelopeBuffer = "";
MessageCopy.RemoveFromStart(InEnvelopeStart);
}

InOutEnvelopeBuffer.Append(MessageCopy);

if(InEnvelopeEnd.IsEmpty())
{
UE_LOG(LogAccelByteChat, Warning, TEXT("WsEnvelopeEnd is empty string, "
"event though WsEnvelopeStart is not empty.\nWill not detect fragmented message"));
}
else
{
if(!InOutEnvelopeBuffer.EndsWith(InEnvelopeEnd))
{
// message is fragmented, should wait next message
OutIsMessageEnd = false;
return;
}
else
{
InOutEnvelopeBuffer.RemoveFromEnd(InEnvelopeEnd);
}
}

OutMessage = InOutEnvelopeBuffer;
InOutEnvelopeBuffer = "";
}

OutIsMessageEnd = true;
}

void Chat::OnMessage(const FString& Message)
{
Expand All @@ -752,7 +721,8 @@ namespace AccelByte

bool bIsFragmentedEnd {false};
FString ProcessedMessage;
ProcessFragmentedMessage(Message, WsEnvelopeStart, WsEnvelopeEnd, EnvelopeContentBuffer, ProcessedMessage, bIsFragmentedEnd);
MessageParser::ProcessFragmentedMessage(Message, WsEnvelopeStart, WsEnvelopeEnd,
EnvelopeContentBuffer, ProcessedMessage, bIsFragmentedEnd);

if(!bIsFragmentedEnd)
return;
Expand All @@ -768,6 +738,13 @@ namespace AccelByte
IncomingMessage::ConvertJsonTimeFormatToFDateTimeFriendly(MessageAsJsonObj);

const HandleType HandleType = IncomingMessage::GetHandleType(HandlerStringEnumMap, MessageAsJsonObj);
const FString MessageType = MessageAsJsonObj->GetStringField(ChatToken::Json::Field::Method);

if(NetworkConditioner.CalculateFail(MessageType))
{
UE_LOG(LogAccelByte, Log, TEXT("[AccelByteNetworkConditioner] Dropped chat message method %s"), *MessageType);
return;
}

switch (HandleType)
{
Expand Down Expand Up @@ -826,7 +803,6 @@ namespace AccelByte
{
bBanNotifReceived = true;
FAccelByteModelsChatUserBanUnbanNotif Data;
ChatCredentialsRef.OnTokenRefreshed().Remove(TokenRefreshDelegateHandle);
TSharedPtr<FJsonObject> Result = MessageAsJsonObj->GetObjectField(ChatToken::Json::Field::Params);
if (const bool bParseSuccess = FJsonObjectConverter::JsonObjectToUStruct(Result.ToSharedRef(), &Data, 0, 0))
{
Expand Down Expand Up @@ -1243,8 +1219,8 @@ namespace AccelByte
}

FString Chat::RefreshToken(const FString& AccessToken
, const FChatRefreshTokenResponse& OnSuccess
, const FErrorHandler& OnError)
, const FChatRefreshTokenResponse& OnSuccess
, const FErrorHandler& OnError)
{
FReport::Log(FString(__FUNCTION__));
FJsonDomBuilder::FObject Params;
Expand Down
Loading

0 comments on commit 35bbb5e

Please sign in to comment.