Beamable SDK
Public Member Functions | Properties | Events | List of all members
Beamable.Api.Connectivity.IConnectivityService Interface Reference

This type defines the Client main entry point for the Connectivity feature. More...

Inheritance diagram for Beamable.Api.Connectivity.IConnectivityService:
Inheritance graph
[legend]

Public Member Functions

Promise SetHasInternet (bool hasInternet)
 Force the value of HasConnectivity. The connectivity is checked periodically, so if the given hasInternet value is not correct, the connectivity will be updated soon. If the given hasInternet value is different than the current HasConnectivity property, then the OnConnectivityChanged event will trigger as part of the execution of this method. More...
 
Promise ReportInternetLoss ()
 Force the value of HasConnectivity to be false. The connectivity is checked periodically, so if internet connectivity returns, the HasConnectivity will be updated soon. If the value of HasConnectivity used to be true, then the OnConnectivityChanged event will trigger as part of the execution of this method. More...
 
void OnReconnectOnce (Action onReconnection)
 Run an action when the HasConnectivity value returns to true. If the HasConnectivity is already true, the action will be evaluated immediately. After connectivity is restored, and the action is executed, the action will never be executed again, even if further internet drops and restorations occur. See also the OnReconnectOnce(ConnectionCallback,int method. More...
 
void OnReconnectOnce (ConnectionCallback promise, int order=0)
 Enqueue a Promise to run when the HasConnectivity value returns to true. If the HasConnectivity is already true, the promise will be evaluated immediately. When connectivity is restored, all of the ConnectionCallback's will be invoked, and the Promises that are created will be awaited before the SetHasInternet's return Promise is completed. More...
 

Properties

bool HasConnectivity [get]
 true when Beamable thinks the current device has an internet connection. This property will update automatically as the device goes on and off line. You can sue the OnConnectivityChanged event to listen for changes in this property.
 
bool ForceDisabled [getset]
 This property allows you to simulate network outage. When true, the Disabled property will be triggered, which forces the HasConnectivity to be false, even if the device is online. When false, it is still possible that Disabled can be triggered, if the IConnectivityServiceExtensions.GlobalForceDisabled property has been set.
 
bool Disabled [get]
 true if the ForceDisabled property has been set to true, OR if the IConnectivityServiceExtensions.GlobalForceDisabled property has been set to true. When Disabled is true, the HasConnectivity property will be forced to false. This can be helpful to simulate network outage, even if the device is online.
 

Events

Action< bool > OnConnectivityChanged
 An event that will trigger anytime the HasConnectivity status changes.
 

Detailed Description

This type defines the Client main entry point for the Connectivity feature.

Related Links

img beamable-logo

Member Function Documentation

◆ OnReconnectOnce() [1/2]

void Beamable.Api.Connectivity.IConnectivityService.OnReconnectOnce ( Action  onReconnection)

Run an action when the HasConnectivity value returns to true. If the HasConnectivity is already true, the action will be evaluated immediately. After connectivity is restored, and the action is executed, the action will never be executed again, even if further internet drops and restorations occur. See also the OnReconnectOnce(ConnectionCallback,int method.

Parameters
onReconnectionSome action to invoke when internet connectivity returns.

Implemented in Beamable.Api.Connectivity.ConnectivityService.

◆ OnReconnectOnce() [2/2]

void Beamable.Api.Connectivity.IConnectivityService.OnReconnectOnce ( ConnectionCallback  promise,
int  order = 0 
)

Enqueue a Promise to run when the HasConnectivity value returns to true. If the HasConnectivity is already true, the promise will be evaluated immediately. When connectivity is restored, all of the ConnectionCallback's will be invoked, and the Promises that are created will be awaited before the SetHasInternet's return Promise is completed.

Parameters
promiseSome function that generates a Promise. The generator will be evaluated when internet is restored.
orderThe order to invoke the promise

Implemented in Beamable.Api.Connectivity.ConnectivityService.

◆ ReportInternetLoss()

Promise Beamable.Api.Connectivity.IConnectivityService.ReportInternetLoss ( )

Force the value of HasConnectivity to be false. The connectivity is checked periodically, so if internet connectivity returns, the HasConnectivity will be updated soon. If the value of HasConnectivity used to be true, then the OnConnectivityChanged event will trigger as part of the execution of this method.

Returns
A Promise representing the completion of the operation.

Implemented in Beamable.Api.Connectivity.ConnectivityService.

◆ SetHasInternet()

Promise Beamable.Api.Connectivity.IConnectivityService.SetHasInternet ( bool  hasInternet)

Force the value of HasConnectivity. The connectivity is checked periodically, so if the given hasInternet value is not correct, the connectivity will be updated soon. If the given hasInternet value is different than the current HasConnectivity property, then the OnConnectivityChanged event will trigger as part of the execution of this method.

Parameters
hasInternettrue if the device has internet, false otherwise.
Returns
A Promise representing the completion of the operation. The promise will not complete until all promises registered with the OnReconnectOnce(ConnectionCallback,int method have completed.

Implemented in Beamable.Api.Connectivity.ConnectivityService.


The documentation for this interface was generated from the following file: