beamable / UnrealSDK

https://beamable.github.io/UnrealSDK/
6 stars 2 forks source link

[UNREAL] Connectivity Loss Handling #56

Open cdhanna opened 1 month ago

cdhanna commented 1 month ago

Connectivity Semantics

In UE, our customers MUST specify a UserSlot as the "Main" slot (the owner of the game). That player’s connectivity defines the connectivity for the entire local client.

Connectivity is tracked through our WebSocket connection established at sign in time. If the connection fails to connect OR gets closed due to connection issues, we try and verify that we CAN reach some open endpoint (typically google, selected from a list of configurable high-availability endpoints). If that fails, we go into our Connectivity Loss Handling with “No Internet Connection”. Otherwise, we fail with “Beamable Server could not be reached“. The Connectivity Handling flow is the same either way, but its nice for us to be able to differentiate between these.

Connectivity Loss Handling

Users should be able to configure how they want to handle connectivity losses in the SDK. Options are:

Connection loss is handled as part of a UBeamBackend connectivity tick function --- UBeamNotification system that manages the websocket connections will flag connectivity as lost when it closes due to a connection failure and the beam backend's tick function listens for that kind of thing of both the OwnerPlayer User Slot as well as the MainEditorDeveloper User Slot. Editor systems care about connectivity from the perspective of the MainEditorDeveloper user and UBeamRuntime from the OwnerPlayer one.

cdhanna commented 1 month ago

this is especially important for working in the editor with unstable internet.