UnrealVoxta 0.1.1
 
Loading...
Searching...
No Matches
FHubConnection Class Reference

Implements a connection to a SignalR hub. More...

#include <HubConnection.h>

Inheritance diagram for FHubConnection:
IHubConnection

Public Member Functions

 FHubConnection (const FString &InUrl, const TMap< FString, FString > &InHeaders)
 Creates a new connection to a SignalR hub.
 
virtual ~FHubConnection ()
 Destructor for the hub connection.
 
virtual void Start () override
 Starts the hub connection.
 
virtual void Stop () override
 Stops the hub connection.
 
virtual FORCEINLINE FOnHubConnectedEvent & OnConnected () override
 Gets the event that is triggered when the hub connection is established.
 
virtual FORCEINLINE FOnHubConnectionErrorEvent & OnConnectionError () override
 Gets the event that is triggered when a hub connection error occurs.
 
virtual FORCEINLINE FHubConnectionClosedEvent & OnClosed () override
 Gets the event that is triggered when the hub connection is closed.
 
virtual FOnMethodInvocation & On (const FString &EventName) override
 Registers a handler for a hub method invocation.
 
virtual FOnMethodCompletion & Invoke (const FString &EventName, const TArray< FSignalRValue > &InArguments=TArray< FSignalRValue >()) override
 Invokes a hub method with the specified arguments and waits for the result.
 
virtual void Send (const FString &InEventName, const TArray< FSignalRValue > &InArguments=TArray< FSignalRValue >()) override
 Sends a hub method invocation with the specified arguments without waiting for a result.
 
virtual void Tick (float DeltaTime) override
 Ticks the hub connection, used for periodic tasks such as sending pings.
 
TStatId GetStatId () const override
 Gets the stat ID for this tickable object.
 
virtual ETickableTickType GetTickableTickType () const override
 Gets the tickable tick type for this object.
 
virtual bool IsTickable () const override
 Determines if this object is tickable.
 
virtual bool IsTickableInEditor () const override
 Determines if this object is tickable in the editor.
 
virtual bool IsTickableWhenPaused () const override
 Determines if this object is tickable when the game is paused.
 
- Public Member Functions inherited from IHubConnection
 DECLARE_EVENT (IHubConnection, FOnHubConnectedEvent)
 Delegate called when a connection has been established successfully.
 
 DECLARE_EVENT_OneParam (IHubConnection, FOnHubConnectionErrorEvent, const FString &)
 Delegate called when a connection could not be established.
 
 DECLARE_EVENT (IHubConnection, FHubConnectionClosedEvent)
 Delegate called when a web socket connection has been closed.
 
 DECLARE_DELEGATE_OneParam (FOnMethodInvocation, const TArray< FSignalRValue > &)
 
 DECLARE_DELEGATE_OneParam (FOnMethodCompletion, const FSignalRInvokeResult &)
 
template<typename... ArgTypes>
FORCEINLINE FOnMethodCompletion & Invoke (const FString &EventName, ArgTypes... Arguments)
 Templated version of Invoke that converts arguments to FSignalRValue automatically.
 
template<typename... ArgTypes>
FORCEINLINE void Send (const FString &EventName, ArgTypes... Arguments)
 Templated version of Send that converts arguments to FSignalRValue automatically.
 

Static Public Attributes

static constexpr float PingTimer = 10.0f
 

Protected Member Functions

void ProcessMessage (const FString &InMessageStr)
 
- Protected Member Functions inherited from IHubConnection
virtual ~IHubConnection ()
 

Detailed Description

Implements a connection to a SignalR hub.

Provides methods to start and stop the connection, invoke hub methods, and register handlers for hub method invocations.

Constructor & Destructor Documentation

◆ FHubConnection()

FHubConnection::FHubConnection ( const FString & InUrl,
const TMap< FString, FString > & InHeaders )

Creates a new connection to a SignalR hub.

Parameters
InUrlThe URL of the SignalR hub.
InHeadersHTTP headers to include in requests to the server.

◆ ~FHubConnection()

FHubConnection::~FHubConnection ( )
virtual

Destructor for the hub connection.

Cleans up resources and closes the connection if necessary.

Member Function Documentation

◆ GetStatId()

TStatId FHubConnection::GetStatId ( ) const
override

Gets the stat ID for this tickable object.

Returns
The stat ID.

◆ GetTickableTickType()

virtual ETickableTickType FHubConnection::GetTickableTickType ( ) const
inlineoverridevirtual

Gets the tickable tick type for this object.

Returns
The tickable tick type.

◆ Invoke()

IHubConnection::FOnMethodCompletion & FHubConnection::Invoke ( const FString & EventName,
const TArray< FSignalRValue > & InArguments = TArray<FSignalRValue>() )
overridevirtual

Invokes a hub method with the specified arguments and waits for the result.

Parameters
EventNameThe name of the hub method to invoke.
InArgumentsThe arguments to pass to the hub method.
Returns
Reference to the method completion delegate that will be called when the method completes.

Implements IHubConnection.

◆ IsTickable()

virtual bool FHubConnection::IsTickable ( ) const
inlineoverridevirtual

Determines if this object is tickable.

Returns
True if tickable, false otherwise.

◆ IsTickableInEditor()

virtual bool FHubConnection::IsTickableInEditor ( ) const
inlineoverridevirtual

Determines if this object is tickable in the editor.

Returns
True if tickable in editor, false otherwise.

◆ IsTickableWhenPaused()

virtual bool FHubConnection::IsTickableWhenPaused ( ) const
inlineoverridevirtual

Determines if this object is tickable when the game is paused.

Returns
True if tickable when paused, false otherwise.

◆ On()

IHubConnection::FOnMethodInvocation & FHubConnection::On ( const FString & EventName)
overridevirtual

Registers a handler for a hub method invocation.

Parameters
EventNameThe name of the hub method.
Returns
Reference to the method invocation delegate.

Implements IHubConnection.

◆ OnClosed()

virtual FORCEINLINE FHubConnectionClosedEvent & FHubConnection::OnClosed ( )
inlineoverridevirtual

Gets the event that is triggered when the hub connection is closed.

Returns
Reference to the hub connection closed event.

Implements IHubConnection.

◆ OnConnected()

virtual FORCEINLINE FOnHubConnectedEvent & FHubConnection::OnConnected ( )
inlineoverridevirtual

Gets the event that is triggered when the hub connection is established.

Returns
Reference to the hub connected event.

Implements IHubConnection.

◆ OnConnectionError()

virtual FORCEINLINE FOnHubConnectionErrorEvent & FHubConnection::OnConnectionError ( )
inlineoverridevirtual

Gets the event that is triggered when a hub connection error occurs.

Returns
Reference to the hub connection error event.

Implements IHubConnection.

◆ ProcessMessage()

void FHubConnection::ProcessMessage ( const FString & InMessageStr)
protected

◆ Send()

void FHubConnection::Send ( const FString & InEventName,
const TArray< FSignalRValue > & InArguments = TArray<FSignalRValue>() )
overridevirtual

Sends a hub method invocation with the specified arguments without waiting for a result.

Parameters
InEventNameThe name of the hub method to invoke.
InArgumentsThe arguments to pass to the hub method.

Implements IHubConnection.

◆ Start()

void FHubConnection::Start ( )
overridevirtual

Starts the hub connection.

Initiates the connection process to the SignalR hub.

Implements IHubConnection.

◆ Stop()

void FHubConnection::Stop ( )
overridevirtual

Stops the hub connection.

Closes the connection to the SignalR hub and cleans up resources.

Implements IHubConnection.

◆ Tick()

void FHubConnection::Tick ( float DeltaTime)
overridevirtual

Ticks the hub connection, used for periodic tasks such as sending pings.

Parameters
DeltaTimeThe time elapsed since the last tick.

Member Data Documentation

◆ PingTimer

float FHubConnection::PingTimer = 10.0f
staticconstexpr

The documentation for this class was generated from the following files: