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/ISignalingJsonRpcInterop.h"
14#include "mc/platform/Copyable.h"
15#include "mc/platform/ErrorInfo.h"
16#include "mc/platform/Result.h"
25namespace Bedrock::Http {
class HeaderCollection; }
26namespace Bedrock::Http {
class RetryPolicy; }
27namespace Bedrock::Http {
struct Url; }
28namespace Bedrock::PubSub {
class Subscription; }
29namespace Json {
class Value; }
30namespace NetherNet {
struct ISignalingEventHandler; }
31namespace NetherNet {
struct NetworkID; }
32namespace NetherNet {
struct StunRelayServer; }
33namespace PlayerMessaging {
struct NetworkID; }
34namespace PlayerMessaging {
struct SigninID; }
38 public ::std::enable_shared_from_this<::SignalingService> {
51 enum class SignInError :
int {
53 EmptyAuthFromDiscovery = 100,
54 EmptyUrlFromDiscovery = 101,
55 ExpiredAuthFromDiscovery = 102,
58 enum class ConnectionStatus : uchar {
66 enum class ServiceError :
int {
68 PlayerUnreachable = 1,
69 MessageDeliveryFailed = 2,
71 FallbackToBestEffortDelivery = 4,
103 virtual void onMessage(::std::string_view incomingMessage) ;
106 virtual bool shouldReconnect()
const ;
109 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() ;
112 virtual ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection> getHeaders() ;
115 virtual ::Bedrock::Http::RetryPolicy getReconnectPolicy() ;
118 virtual void onConnect() ;
121 virtual void onDisconnect(
bool, uint closeStatus) ;
124 virtual void _requestTurnConfig()
const;
127 virtual void _sendPing()
const;
130 virtual void onAppSuspended() ;
133 virtual void onAppResumed() ;
141 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
142 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing,
147 ::SignalingService::Connection::ServiceError errorCode,
148 ::std::string
const& errorMessage,
149 ::std::string
const& messageId
152 MCNAPI
void _parseError(::std::string
const& message, ::std::string messageId);
154 MCNAPI ::Bedrock::Result<::std::vector<::NetherNet::StunRelayServer>, ::NetherNet::ESessionError>
158 ::NetherNet::ESessionError result,
159 ::std::vector<::NetherNet::StunRelayServer>
const& config
162 MCNAPI ::Bedrock::Threading::Async<::std::error_code>
connect();
172 MCNAPI ::Bedrock::Threading::Async<::NetherNet::ESessionError>
183 ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider> serviceConfigProvider,
184 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing,
202 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url>
$getUrl();
204 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection>
$getHeaders();
248 virtual ::Bedrock::Threading::Async<::Bedrock::Http::Url> getUrl() ;
251 virtual void onMessage(::std::string_view incomingMessage) ;
254 virtual void onConnect() ;
260 virtual void _sendPing()
const ;
263 virtual void _requestTurnConfig()
const ;
269 MCNAPI ::Bedrock::Threading::Async<
273 MCNAPI ::Bedrock::Threading::Async<
277 ::std::optional<::std::string>
const& messageId,
278 ::std::string
const& message
285 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url>
$getUrl();
332 virtual void SendSignal(
334 ::std::string
const& message,
335 ::std::function<
void(::NetherNet::ESessionError)>&& onComplete
339 virtual ::Bedrock::PubSub::Subscription
348 ::std::string
const& message,
349 ::std::function<
void(::NetherNet::ESessionError)>&& onComplete
358 ::std::string
const& message,
359 ::std::function<
void(::NetherNet::ESessionError)>&& onComplete
392 virtual ::Bedrock::Threading::Async<
396 ::std::optional<::std::string>
const& messageId,
397 ::std::string
const& message
401 virtual ::Bedrock::Threading::Async<
403 sendJsonRpc(::std::string
const& message)
const ;
406 virtual ::gsl::not_null<::std::shared_ptr<::MessageTracker>> getMessageTracker() ;
416 virtual void setTurnConfig(
417 ::std::vector<::NetherNet::StunRelayServer>&& config,
418 ::std::chrono::steady_clock::time_point expiration
428 MCNAPI ::Bedrock::Threading::Async<
432 ::std::optional<::std::string>
const& messageId,
433 ::std::string
const& message
436 MCNAPI ::Bedrock::Threading::Async<
447 ::std::vector<::NetherNet::StunRelayServer>&& config,
448 ::std::chrono::steady_clock::time_point expiration
495 ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing> eventing,
502 MCNAPI ::Bedrock::Threading::Async<::std::vector<::NetherNet::StunRelayServer>>
getRelayConfig()
const;
Definition EnableNonOwnerReferences.h:7
Definition PersistentWebSocket.h:20
Definition IMinecraftEventing.h:149
Definition ISignalingJsonRpcInterop.h:21
Definition ISignalingServiceConfigProvider.h:14
Definition MessageTracker.h:18
Definition ISignalingInterface.h:17
Definition Scheduler.h:13
Definition SignalingService.h:309
MCAPI void _SendJsonRpcSignal(::NetherNet::NetworkID networkIDTo, ::std::string const &message, ::std::function< void(::NetherNet::ESessionError)> &&onComplete)
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:63
MCAPI void * $ctor(::PlayerMessaging::SigninID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing, bool useJsonRpc)
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 _sendTurnConfigTelemetry(::NetherNet::ESessionError result, ::std::vector<::NetherNet::StunRelayServer > const &config)
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI void onTurnConfigFailure(::Bedrock::ErrorInfo<::NetherNet::ESessionError > const &error)
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 Connection(::PlayerMessaging::SigninID id, ::Bedrock::NotNullNonOwnerPtr<::ISignalingServiceConfigProvider > serviceConfigProvider, ::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing, bool useJsonRpc)
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 void parseSignal(::NetherNet::NetworkID fromNetworkID, ::std::string message, ::std::string messageId)
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::HeaderCollection > $getHeaders()
Definition SignalingService.h:305
Definition SignalingService.h:230
MCAPI void $onMessage(::std::string_view incomingMessage)
MCAPI void $_sendPing() const
MCAPI ::Bedrock::Threading::Async< ::Bedrock::Copyable<::Bedrock::Result<::std::monostate, ::NetherNet::ESessionError > > > sendJsonRpcTo(::PlayerMessaging::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message)
MCAPI ::Bedrock::Threading::Async< ::Bedrock::Copyable<::Bedrock::Result<::std::monostate, ::NetherNet::ESessionError > > > sendJsonRpc(::std::string const &message)
MCAPI void $_requestTurnConfig() const
static MCAPI void ** $vftableForPersistentWebSocket()
MCAPI ::Bedrock::Threading::Async<::Bedrock::Http::Url > $getUrl()
static MCAPI void ** $vftableForAppPlatformListener()
Definition SignalingService.h:372
MCAPI ::Bedrock::Threading::Async< ::Bedrock::Copyable<::Bedrock::Result<::std::monostate, ::NetherNet::ESessionError > > > $sendJsonRpcTo(::PlayerMessaging::NetworkID networkIdTo, ::std::optional<::std::string > const &messageId, ::std::string const &message) const
MCAPI ::Bedrock::Threading::Async< ::Bedrock::Copyable<::Bedrock::Result<::std::monostate, ::NetherNet::ESessionError > > > $sendJsonRpc(::std::string const &message) const
MCAPI void $parseSignal(::NetherNet::NetworkID fromNetworkID, ::std::string message, ::std::string messageId)
MCAPI void $setTurnConfig(::std::vector<::NetherNet::StunRelayServer > &&config, ::std::chrono::steady_clock::time_point expiration)
static MCAPI void ** $vftable()
MCAPI ::gsl::not_null<::std::shared_ptr<::MessageTracker > > $getMessageTracker()
MCAPI void $onTurnConfigFailure(::Bedrock::ErrorInfo<::NetherNet::ESessionError > const &error)
MCAPI void $parseTurnConfig(::Json::Value const &config)
Definition SignalingService.h:307
Definition SignalingService.h:38
MCAPI ::Bedrock::Threading::Async<::std::error_code > signIn(::PlayerMessaging::SigninID localId)
MCAPI ::std::shared_ptr<::SignalingService::Connection > _makeConnection(::PlayerMessaging::SigninID id)
MCAPI void * $ctor(::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing, ::WorkerPool &pool, ::Scheduler &scheduler)
MCAPI SignalingService(::Bedrock::NotNullNonOwnerPtr<::IMinecraftEventing > eventing, ::WorkerPool &pool, ::Scheduler &scheduler)
MCAPI ::Bedrock::Threading::Async<::std::vector<::NetherNet::StunRelayServer > > getRelayConfig() const
static MCAPI void ** $vftable()
Definition WorkerPool.h:19
Definition ISignalingEventHandler.h:12
Definition NetworkID.h:17