UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
WinHttpWebSocket.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_WEBSOCKETS && WITH_WINHTTPWEBSOCKETS
6
7#include "CoreMinimal.h"
8#include "IWebSocket.h"
9
11class FWinHttpSession;
12enum class EWebSocketMessageType : uint8;
13
15{
23 FailedToConnect,
27 Closed
28};
29
31
33 : public IWebSocket
34 , public TSharedFromThis<FWinHttpWebSocket>
35{
36public:
38 virtual ~FWinHttpWebSocket();
39
40 //~ Begin IWebSocket Interface
41 virtual void Connect() override final;
42 virtual void Close(const int32 Code = 1000, const FString& Reason = FString()) override final;
43 virtual bool IsConnected() override final;
44 virtual void Send(const FString& Data) override final;
45 virtual void Send(const void* Data, SIZE_T Size, bool bIsBinary) override final;
46 virtual void SetTextMessageMemoryLimit(uint64 TextMessageMemoryLimit) override final;
48 virtual FWebSocketConnectedEvent& OnConnected() override final;
50 virtual FWebSocketConnectionErrorEvent& OnConnectionError() override final;
52 virtual FWebSocketClosedEvent& OnClosed() override final;
54 virtual FWebSocketMessageEvent& OnMessage() override final;
57 virtual FWebSocketBinaryMessageEvent& OnBinaryMessage() override final;
58 virtual FWebSocketRawMessageEvent& OnRawMessage() override final;
60 virtual FWebSocketMessageSentEvent& OnMessageSent() override final;
61 //~ End IWebSocket Interface
62
65 void HandleCloseComplete(const EWebSocketConnectionState NewState, const uint16 Code, const FString& Reason);
66
68 void GameThreadTick();
69
70 //~ Begin FWinHttpConnectionWebSocket Callbacks
73 void HandleWebSocketClosed(uint16 Code, const FString& Reason, bool bGracefulDisconnect);
74 //~ End FWinHttpConnectionWebSocket Callbacks
75
77 FString Url;
78 TArray<FString> Protocols;
79 TMap<FString, FString> UpgradeHeaders;
80
85 TOptional<FString> QueuedCloseReason;
87
95
97};
98
99#endif // WITH_WEBSOCKETS && WITH_WINHTTPWEBSOCKETS
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DERIVED_EVENT(OwningType, BaseTypeEvent, EventName)
Definition Delegate.h:231
JsonWriter Close()
const TCHAR * LexToString(EAnalyticsRecordEventMode Mode)
Definition IAnalyticsProvider.cpp:5
ESPMode
Definition SharedPointerFwd.h:12
uint32 Size
Definition VulkanMemory.cpp:4034
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
Definition IWebSocket.h:7
virtual void Connect()=0
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:1640
Definition SharedPointer.h:692
@ false
Definition radaudio_common.h:23
Definition Optional.h:131