DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
WebSocketContext.h
Go to the documentation of this file.
1
3
4
#pragma once
5
6
#include "
Common.h
"
7
#include "
System/Object.h
"
8
#include "
System/String.h
"
9
#include "
System/SmartPointer.h
"
10
#include "
System/Action.h
"
11
#include "
System/Net/WebSockets/WebSocket.h
"
12
#include "
WebAppCore/Http/HttpContext.h
"
13
14
namespace
DotNetDupe
{
15
namespace
WebAppCore
{
16
namespace
WebSockets
{
17
26
class
WebSocketContext
:
public
virtual
DotNetDupe::System::Object
{
27
public
:
31
DOTNETDUPE_API
WebSocketContext
(
DotNetDupe::System::SmartPointer<Http::HttpContext>
pContext,
32
DotNetDupe::System::SmartPointer<DotNetDupe::System::Net::WebSockets::WebSocket>
pWebSocket)
33
: m_pContext(pContext), m_pWebSocket(pWebSocket) {}
34
36
DOTNETDUPE_API
~WebSocketContext
()
override
=
default
;
37
40
DOTNETDUPE_API
DotNetDupe::System::SmartPointer<Http::HttpContext>
GetHttpContext
()
const
{
return
m_pContext; }
41
44
DOTNETDUPE_API
DotNetDupe::System::SmartPointer<DotNetDupe::System::Net::WebSockets::WebSocket>
GetWebSocket
()
const
{
return
m_pWebSocket; }
45
46
private
:
47
DotNetDupe::System::SmartPointer<Http::HttpContext>
m_pContext;
48
DotNetDupe::System::SmartPointer<DotNetDupe::System::Net::WebSockets::WebSocket>
m_pWebSocket;
49
};
50
59
class
IWebSocketHandler
:
public
virtual
DotNetDupe::System::Object
{
60
public
:
62
DOTNETDUPE_API
~IWebSocketHandler
()
override
=
default
;
63
66
DOTNETDUPE_API
virtual
void
OnConnected
(
DotNetDupe::System::SmartPointer<WebSocketContext>
pContext) = 0;
67
71
DOTNETDUPE_API
virtual
void
OnMessage
(
DotNetDupe::System::SmartPointer<WebSocketContext>
pContext,
const
DotNetDupe::System::String
& message) = 0;
72
75
DOTNETDUPE_API
virtual
void
OnDisconnected
(
DotNetDupe::System::SmartPointer<WebSocketContext>
pContext) = 0;
76
};
77
78
}
79
}
80
}
Action.h
Encapsulates a delegate method that has parameters and returns void.
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
HttpContext.h
HTTP request, response, and context abstractions for WebAppCore processing pipelines.
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
WebSocket.h
Represents an RFC 6455 full-duplex WebSocket connection over a NetworkStream.
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::WebAppCore::WebSockets::IWebSocketHandler
Interface for receiving WebSocket connection lifecycle events and incoming messages.
Definition
WebSocketContext.h:59
DotNetDupe::WebAppCore::WebSockets::IWebSocketHandler::OnMessage
virtual void OnMessage(DotNetDupe::System::SmartPointer< WebSocketContext > pContext, const DotNetDupe::System::String &message)=0
Invoked when a complete text message frame is received from the remote client.
DotNetDupe::WebAppCore::WebSockets::IWebSocketHandler::OnDisconnected
virtual void OnDisconnected(DotNetDupe::System::SmartPointer< WebSocketContext > pContext)=0
Invoked when the WebSocket connection is closed or the remote peer disconnects.
DotNetDupe::WebAppCore::WebSockets::IWebSocketHandler::~IWebSocketHandler
~IWebSocketHandler() override=default
Virtual destructor.
DotNetDupe::WebAppCore::WebSockets::IWebSocketHandler::OnConnected
virtual void OnConnected(DotNetDupe::System::SmartPointer< WebSocketContext > pContext)=0
Invoked immediately after a successful RFC 6455 WebSocket handshake.
DotNetDupe::WebAppCore::WebSockets::WebSocketContext::GetWebSocket
DotNetDupe::System::SmartPointer< DotNetDupe::System::Net::WebSockets::WebSocket > GetWebSocket() const
Gets the active bidirectional WebSocket connection.
Definition
WebSocketContext.h:44
DotNetDupe::WebAppCore::WebSockets::WebSocketContext::GetHttpContext
DotNetDupe::System::SmartPointer< Http::HttpContext > GetHttpContext() const
Gets the originating HTTP upgrade context.
Definition
WebSocketContext.h:40
DotNetDupe::WebAppCore::WebSockets::WebSocketContext::~WebSocketContext
~WebSocketContext() override=default
Virtual destructor.
DotNetDupe::WebAppCore::WebSockets::WebSocketContext::WebSocketContext
WebSocketContext(DotNetDupe::System::SmartPointer< Http::HttpContext > pContext, DotNetDupe::System::SmartPointer< DotNetDupe::System::Net::WebSockets::WebSocket > pWebSocket)
Constructs a WebSocketContext wrapping the originating HttpContext and active WebSocket.
Definition
WebSocketContext.h:31
DotNetDupe::WebAppCore::WebSockets
Definition
WebSocketContext.h:16
DotNetDupe::WebAppCore
Definition
WebApplication.h:20
DotNetDupe
Definition
IServiceCollection.h:7
Include
WebAppCore
WebSockets
WebSocketContext.h
Generated by
1.18.0