3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/deps/application/AppPlatformListener.h"
7#include "mc/deps/core/http/PersistentWebSocket.h"
8#include "mc/deps/core/threading/Async.h"
9#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
10#include "mc/deps/core/utility/NonOwnerPointer.h"
11#include "mc/deps/nether_net/ESessionError.h"
12#include "mc/deps/nether_net/ISignalingInterface.h"
13#include "mc/network/services/signaling/json_rpc/JsonRpcProvider.h"
14#include "mc/platform/ErrorInfo.h"
15#include "mc/platform/Result.h"
23namespace Bedrock::Http {
class HeaderCollection; }
24namespace Bedrock::Http {
class RetryPolicy; }
25namespace Bedrock::Http {
struct Url; }
26namespace Bedrock::PubSub {
class Subscription; }
27namespace Json {
class Value; }
28namespace NetherNet {
struct ISignalingEventHandler; }
29namespace NetherNet {
struct NetworkID; }
30namespace NetherNet {
struct StunRelayServer; }
31namespace cereal {
struct ReflectionCtx; }
36 public ::std::enable_shared_from_this<::SignalingService> {
48 enum class ConnectionStatus : uchar {
56 enum class ServiceError :
int {
58 PlayerUnreachable = 1,
59 MessageDeliveryFailed = 2,
61 FallbackToBestEffortDelivery = 4,
93 virtual void onMessage(::std::string_view incomingMessage) ;
96 virtual bool shouldReconnect()
const ;
99 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() ;
102 virtual ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection> getHeaders() ;
105 virtual ::Bedrock::Http::RetryPolicy getReconnectPolicy() ;
108 virtual void onConnect() ;
111 virtual void onDisconnect(
bool, uint closeStatus) ;
114 virtual void _requestTurnConfig()
const;
117 virtual void _sendPing()
const;
120 virtual void onAppSuspended() ;
123 virtual void onAppResumed() ;
131 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
132 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing
136 ::SignalingService::Connection::ServiceError errorCode,
137 ::std::string
const& errorMessage,
138 ::std::string
const& messageId
143 MCNAPI
void _parseError(::std::string
const& message, ::std::string messageId);
147 MCNAPI ::Bedrock::Result<::std::vector<::NetherNet::StunRelayServer>, ::NetherNet::ESessionError>
151 ::NetherNet::ESessionError result,
152 ::std::vector<::NetherNet::StunRelayServer>
const& config
155 MCNAPI ::Bedrock::Threading::Async<::std::error_code>
connect();
161 MCNAPI ::Bedrock::Threading::Async<::NetherNet::ESessionError>
172 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
173 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing
190 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url>
$getUrl();
192 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection>
$getHeaders();
235 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() ;
238 virtual void onMessage(::std::string_view incomingMessage) ;
241 virtual void onConnect() ;
247 virtual void _sendPing()
const ;
250 virtual void _requestTurnConfig()
const ;
259 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
262 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
sendJsonRpcTo(
264 ::std::optional<::std::string>
const& messageId,
265 ::std::string
const& message
272 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url>
$getUrl();
317 virtual void SendSignal(
319 ::std::string
const& message,
320 ::std::function<
void(::NetherNet::ESessionError)>&& onComplete
324 virtual ::Bedrock::PubSub::Subscription
333 ::std::string
const& message,
334 ::std::function<
void(::NetherNet::ESessionError)>&& onComplete
372 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> sendJsonRpcTo(
374 ::std::optional<::std::string>
const& messageId,
375 ::std::string
const& message
379 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
380 sendJsonRpc(::std::string
const& message)
const ;
383 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>> sendPing() const ;
386 virtual ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
387 sendTurnConfigRequest() ;
390 virtual ::cereal::ReflectionCtx& getReflectionContext() ;
393 virtual ::
std::unique_ptr<::
std::
string, ::
std::function<
void(::
std::
string*)>> registerJsonRpcMethod(
394 ::
std::
string method,
395 ::
std::function<
void(::
std::
string, ::Json::Value const&)> handler
399 virtual
void _unregisterJsonRpcMethod(::
std::
string method) ;
402 virtual
void dispatchJsonRpc(::
std::
string const& method, ::Json::Value const& params) ;
406 handleJsonRpcResult(::
std::
string id, ::nonstd::expected<::Json::Value, ::Json::Value> const& result) ;
420 MCNAPI ::gsl::not_null<::
std::shared_ptr<::NetherNet::ISignalingInterface>>
getChannel() const;
422 MCNAPI ::Bedrock::Threading::Async<::
std::vector<::NetherNet::StunRelayServer>>
getRelayConfig() const;
424 MCNAPI ::Bedrock::Threading::Async<::
std::error_code>
signIn(::NetherNet::NetworkID
id,
bool useJsonRpc);
443 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
$sendJsonRpcTo(
444 ::NetherNet::NetworkID networkIdTo,
445 ::
std::optional<::
std::
string> const& messageId,
446 ::
std::
string const& message
449 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
452 MCNAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value>>
$sendPing() const;
458 MCNAPI ::
std::unique_ptr<::
std::
string, ::
std::function<
void(::
std::
string*)>>
Definition EnableNonOwnerReferences.h:7
Definition PersistentWebSocket.h:20
Definition IMinecraftEventing.h:147
Definition ISignalingServiceConfigProvider.h:14
Definition JsonRpcProvider.h:17
Definition ISignalingInterface.h:17
Definition Scheduler.h:13
Definition SignalingService.h:296
MCAPI void $SendSignal(::NetherNet::NetworkID to, ::std::string const &message, ::std::function< void(::NetherNet::ESessionError)> &&onComplete)
MCAPI::Bedrock::PubSub::Subscription $RegisterEventHandler(::NetherNet::ISignalingEventHandler *handler)
static MCAPI void ** $vftable()
Definition SignalingService.h:53
MCAPI void _parseError(::std::string const &message, ::std::string messageId)
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url > $getUrl()
MCAPI ::Bedrock::Result<::std::vector<::NetherNet::StunRelayServer >, ::NetherNet::ESessionError > _parseTurnConfig(::Json::Value const &config)
MCAPI void parseTurnConfig(::std::string const &bodyText)
static MCAPI void ** $vftableForAppPlatformListener()
MCAPI void _onTurnConfigFailure(::Bedrock::ErrorInfo<::NetherNet::ESessionError > const &error)
MCAPI Connection(::NetherNet::NetworkID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing)
MCAPI void _parseSignal(::NetherNet::NetworkID fromNetworkID, ::std::string message, ::std::string messageId)
MCAPI void _sendTurnConfigTelemetry(::NetherNet::ESessionError result, ::std::vector<::NetherNet::StunRelayServer > const &config)
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI void * $ctor(::NetherNet::NetworkID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing)
MCAPI void $onAppSuspended()
MCAPI void $onDisconnect(bool, uint closeStatus)
MCAPI::Bedrock::Http::RetryPolicy $getReconnectPolicy()
MCAPI void $onAppResumed()
MCAPI bool $shouldReconnect() const
MCAPI void parseTurnConfig(::Json::Value const &config)
MCAPI void $_sendPing() const
MCAPI ::Bedrock::Threading::Async<::std::error_code > connect()
MCAPI void $_requestTurnConfig() const
MCAPI ::Bedrock::Threading::Async<::NetherNet::ESessionError > sendTo(::NetherNet::NetworkID to, ::std::string const &message)
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void _handleError(::SignalingService::Connection::ServiceError errorCode, ::std::string const &errorMessage, ::std::string const &messageId)
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection > $getHeaders()
Definition SignalingService.h:292
Definition SignalingService.h:218
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > sendJsonRpc(::std::string const &message)
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value > const &result)
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > sendJsonRpcTo(::NetherNet::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message)
MCAPI void $_sendPing() const
MCAPI void $_requestTurnConfig() const
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url > $getUrl()
static MCAPI void ** $vftableForAppPlatformListener()
Definition SignalingService.h:294
Definition SignalingService.h:36
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendJsonRpcTo(::NetherNet::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message) const
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendTurnConfigRequest()
MCAPI void $_unregisterJsonRpcMethod(::std::string method)
MCAPI ::Bedrock::Threading::Async<::std::error_code > signIn(::NetherNet::NetworkID id, bool useJsonRpc)
MCAPI ::std::shared_ptr<::SignalingService::Connection > _makeConnection(::NetherNet::NetworkID id, bool jsonRpc)
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendJsonRpc(::std::string const &message) const
MCAPI::cereal::ReflectionCtx & $getReflectionContext()
MCAPI void $dispatchJsonRpc(::std::string const &method, ::Json::Value const ¶ms)
static MCAPI void ** $vftableForJsonRpcProvider()
MCAPI ::gsl::not_null<::std::shared_ptr<::NetherNet::ISignalingInterface > > getChannel() const
static MCAPI void ** $vftableForEnableNonOwnerReferences()
MCAPI ::Bedrock::Threading::Async<::nonstd::expected<::Json::Value, ::Json::Value > > $sendPing() const
MCAPI void $handleJsonRpcResult(::std::string id, ::nonstd::expected<::Json::Value, ::Json::Value > const &result)
MCAPI ::Bedrock::Threading::Async<::std::vector<::NetherNet::StunRelayServer > > getRelayConfig() const
MCAPI ::std::unique_ptr<::std::string, ::std::function< void(::std::string *)> > $registerJsonRpcMethod(::std::string method, ::std::function< void(::std::string, ::Json::Value const &)> handler)
Definition WorkerPool.h:19
Definition ISignalingEventHandler.h:12
Definition NetworkID.h:21