UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SessionService.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "IMessageContext.h"
7#include "IMessageBus.h"
8#include "ISessionService.h"
9#include "MessageEndpoint.h"
10
14
15
20 : public FOutputDevice
21 , public ISessionService
22{
23public:
24
31
33 virtual ~FSessionService();
34
35public:
36
37 //~ FOutputDevice interface
38
39 virtual void Serialize(const TCHAR* Data, ELogVerbosity::Type Verbosity, const class FName& Category) override
40 {
41 SendLog(Data, Verbosity, Category);
42 }
43
44public:
45
46 //~ ISessionService interface
47
48 virtual bool IsRunning() override
49 {
50 return MessageEndpoint.IsValid();
51 }
52
53 virtual bool Start() override;
54 virtual void Stop() override;
55
56protected:
57
65 void SendLog(const TCHAR* Data, ELogVerbosity::Type Verbosity = ELogVerbosity::Log, const class FName& Category = "Log");
66
73 void SendNotification(const TCHAR* NotificationText, const FMessageAddress& Recipient);
74
81 void SendPong(const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context, const FString& UserName);
82
83private:
84
86 void HandleMessageEndpointShutdown();
87
89 void HandleSessionLogSubscribeMessage(const FSessionServiceLogSubscribe& Message, const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context);
90
92 void HandleSessionLogUnsubscribeMessage(const FSessionServiceLogUnsubscribe& Message, const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context);
93
95 void HandleSessionPingMessage(const FSessionServicePing& Message, const TSharedRef<IMessageContext, ESPMode::ThreadSafe>& Context);
96
97private:
98
100 TArray<FMessageAddress> LogSubscribers;
101
103 FCriticalSection LogSubscribersLock;
104
107
110
112 bool IsInSendLog;
113};
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE::FPlatformRecursiveMutex FCriticalSection
Definition CriticalSection.h:53
Definition NameTypes.h:617
Definition OutputDevice.h:133
Definition SessionService.h:22
void SendPong(const TSharedRef< IMessageContext, ESPMode::ThreadSafe > &Context, const FString &UserName)
Definition SessionService.cpp:120
virtual bool IsRunning() override
Definition SessionService.h:48
void SendLog(const TCHAR *Data, ELogVerbosity::Type Verbosity=ELogVerbosity::Log, const class FName &Category="Log")
Definition SessionService.cpp:69
virtual void Serialize(const TCHAR *Data, ELogVerbosity::Type Verbosity, const class FName &Category) override
Definition SessionService.h:39
virtual void Stop() override
Definition SessionService.cpp:56
virtual ~FSessionService()
Definition SessionService.cpp:20
void SendNotification(const TCHAR *NotificationText, const FMessageAddress &Recipient)
Definition SessionService.cpp:100
virtual bool Start() override
Definition SessionService.cpp:29
Definition ISessionService.h:11
Definition Array.h:670
Definition SharedPointer.h:692
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
Type
Definition LogVerbosity.h:17
@ Log
Definition LogVerbosity.h:40
Definition IMessageContext.h:26
Definition SessionServiceMessages.h:140
Definition SessionServiceMessages.h:150
Definition SessionServiceMessages.h:19