Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
WebSocket.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
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
10// auto generated forward declare list
11// clang-format off
12namespace Bedrock::Http { class HeaderCollection; }
13namespace Bedrock::Http::Internal { struct WebSocketCallbackContext; }
15// clang-format on
16
17namespace Bedrock::Http {
18
19class WebSocket : public ::std::enable_shared_from_this<::Bedrock::Http::WebSocket> {
20public:
21 // member variables
22 // NOLINTBEGIN
27 // NOLINTEND
28
29public:
30 // prevent constructor by default
31 WebSocket& operator=(WebSocket const&);
32 WebSocket(WebSocket const&);
33
34public:
35 // virtual functions
36 // NOLINTBEGIN
37 virtual ~WebSocket();
38
39 virtual ::Bedrock::Threading::Async<::std::error_code> send(::std::string const& message) const;
40
41 virtual void onMessage(::std::string_view message);
42
43 virtual void onBinaryMessage(::gsl::span<uchar const>);
44
45 virtual void onClose(uint status);
46 // NOLINTEND
47
48public:
49 // member functions
50 // NOLINTBEGIN
51 MCNAPI WebSocket();
52
53 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Bedrock::Http::StatusCode, ::std::error_code>>
54 connect(::std::string const& uri, ::Bedrock::Http::HeaderCollection const& headers);
55 // NOLINTEND
56
57public:
58 // static functions
59 // NOLINTBEGIN
60 MCNAPI static void _deallocateSocketAsync(
62 ::std::shared_ptr<::Bedrock::Http::Internal::WebSocketCallbackContext> callbackContext
63 );
64 // NOLINTEND
65
66public:
67 // constructor thunks
68 // NOLINTBEGIN
69 MCNAPI void* $ctor();
70 // NOLINTEND
71
72public:
73 // destructor thunk
74 // NOLINTBEGIN
75 MCNAPI void $dtor();
76 // NOLINTEND
77
78public:
79 // virtual function thunks
80 // NOLINTBEGIN
81 MCNAPI ::Bedrock::Threading::Async<::std::error_code> $send(::std::string const& message) const;
82
83 MCNAPI void $onMessage(::std::string_view message);
84
85 MCNAPI void $onBinaryMessage(::gsl::span<uchar const>);
86
87 MCNAPI void $onClose(uint status);
88
89
90 // NOLINTEND
91
92public:
93 // vftables
94 // NOLINTBEGIN
95 MCNAPI static void** $vftable();
96 // NOLINTEND
97};
98
99} // namespace Bedrock::Http
Definition HeaderCollection.h:7
MCAPI void $onMessage(::std::string_view message)
static MCAPI void ** $vftable()
MCAPI ::Bedrock::Threading::Async<::std::error_code > $send(::std::string const &message) const
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)
static MCAPI void _deallocateSocketAsync(::HC_WEBSOCKET_OBSERVER *handle, ::std::shared_ptr<::Bedrock::Http::Internal::WebSocketCallbackContext > callbackContext)
MCAPI void $onBinaryMessage(::gsl::span< uchar const >)
Definition WebSocketCallbackContext.h:8
Definition HC_WEBSOCKET_OBSERVER.h:8
Definition Alias.h:14