3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/deps/core/http/StatusCode.h"
7#include "mc/deps/core/threading/Async.h"
8#include "mc/deps/core/threading/AsyncPromise.h"
9#include "mc/platform/brstd/future.h"
18namespace Bedrock::Http {
20class WebSocket :
public ::std::enable_shared_from_this<::Bedrock::Http::WebSocket> {
31 WebSocket& operator=(WebSocket
const&);
32 WebSocket(WebSocket
const&);
38 virtual ~WebSocket() =
default;
40 virtual ::Bedrock::Threading::Async<::std::error_code> send(::std::string
const& message)
const;
42 virtual void onMessage(::std::string_view incomingMessage);
44 virtual void onBinaryMessage(::gsl::span<uchar const>);
46 virtual void onClose(uint status);
54 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Bedrock::Http::StatusCode, ::std::error_code>>
65 ::std::weak_ptr<::Bedrock::Http::WebSocket> weakThis,
78 MCNAPI ::Bedrock::Threading::Async<::std::error_code>
$send(::std::string
const& message)
const;
80 MCNAPI
void $onMessage(::std::string_view incomingMessage);
static MCAPI void _onSend(::XAsyncBlock *asyncSend, ::Bedrock::Threading::AsyncPromise<::std::error_code > onComplete)
static MCAPI void ** $vftable()
MCAPI ::Bedrock::Threading::Async<::std::error_code > $send(::std::string const &message) const
static MCAPI void _onConnect(::XAsyncBlock *asyncConnect, ::std::weak_ptr<::Bedrock::Http::WebSocket > weakThis, ::Bedrock::Threading::AsyncPromise<::nonstd::expected<::Bedrock::Http::StatusCode, ::std::error_code > > onComplete, ::HC_WEBSOCKET_OBSERVER *connectHandle)
MCAPI::HC_WEBSOCKET_OBSERVER * _allocateSocket(::brstd::future< void > connectCompleted)
MCAPI void $onClose(uint status)
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Bedrock::Http::StatusCode, ::std::error_code > > connect(::std::string const &uri, ::Bedrock::Http::HeaderCollection const &headers)
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void $onBinaryMessage(::gsl::span< uchar const >)
static MCAPI void _deallocateSocketAsync(::HC_WEBSOCKET_OBSERVER *handle)
Definition AsyncPromise.h:8
Definition HC_WEBSOCKET_OBSERVER.h:8
Definition XAsyncBlock.h:10