Make CultMesh session identity explicit
This commit is contained in:
parent
d4d24385d1
commit
c75051017d
24 changed files with 364 additions and 236 deletions
|
|
@ -1,21 +1,28 @@
|
|||
# 2. Connect A Client By Stable Identity
|
||||
|
||||
Clients address a Verse session by stable identity. In this tutorial,
|
||||
`sample.counter-provider` is the sole authority runtime Odin advertises for the
|
||||
`sample.counter` Verse; neither identity is a socket address. Discovery owns
|
||||
current physical candidates and the session manager owns connection reuse,
|
||||
path rotation, and transport failure state.
|
||||
Clients address a live session by stable Verse/provider identity. In this tutorial,
|
||||
`sample.counter` is the Verse id and `sample.counter-provider` is the authority
|
||||
runtime Odin currently advertises for it. Application clients pass that typed
|
||||
pair, never a socket address and never one ambiguous string that might mean
|
||||
either identity. A product may expose only a Verse choice to its user; its
|
||||
selection owner then resolves the provider runtime from Odin's descriptor before
|
||||
opening the session. Discovery owns the current physical routes, and the session
|
||||
manager owns connection reuse, path rotation, and transport failure state.
|
||||
|
||||
```csharp
|
||||
using GameCult.Mesh;
|
||||
|
||||
var odinEndpoint = Environment.GetEnvironmentVariable("ODIN_ENDPOINT")
|
||||
?? throw new InvalidOperationException("Set ODIN_ENDPOINT to the configured rendezvous route.");
|
||||
const string verseId = "sample.counter";
|
||||
var target = new CultMeshSessionTarget(verseId, "sample.counter-provider");
|
||||
using var mesh = new CultMeshClient(new CultMeshClientOptions
|
||||
{
|
||||
RendezvousEndpoints = new[] { "rudp://odin.gamecult.net:3076" }
|
||||
RendezvousEndpoints = new[] { odinEndpoint }
|
||||
});
|
||||
|
||||
using var counterLease = await mesh.LeaseDocumentAsync<CounterState>(
|
||||
"sample.counter",
|
||||
target,
|
||||
"counter:main",
|
||||
cancellationToken);
|
||||
var counter = counterLease.Handle;
|
||||
|
|
@ -40,7 +47,7 @@ protocol-level state or diagnostics:
|
|||
|
||||
```csharp
|
||||
var session = await mesh.ConnectAsync(
|
||||
"aetheria.daemon",
|
||||
target,
|
||||
CultMeshProtocols.Documents,
|
||||
cancellationToken);
|
||||
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ survive reopening the `.cc` store.
|
|||
|
||||
The second layer runs a durable C# provider, a separate local Odin fixture, a
|
||||
real Chromium Eve lowerer, and an independent C# headless observer over binary
|
||||
CultNet WebSocket lanes. The open browser resolves provider identity through
|
||||
the canonical Verse catalog, survives a provider restart on a different route,
|
||||
CultNet WebSocket lanes. The open browser resolves the `sample.counter` Verse
|
||||
through the canonical catalog, survives its provider restarting on a different route,
|
||||
and resubscribes. The retained C# client then invokes a second typed operation
|
||||
through `CultMeshClient.InvokeAsync`; Chromium and C# observe the same
|
||||
provider-authored state and receipt chronology. The same retained C# session
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ The counter is now one small multiplayer game:
|
|||
invokes Increment;
|
||||
- an independent C# client leases the same counter and invokes through the same
|
||||
typed operation boundary;
|
||||
- both clients remain attached when Odin moves the provider identity to a new
|
||||
physical route.
|
||||
- both clients remain attached when Odin moves the Verse to a replacement
|
||||
physical provider route.
|
||||
|
||||
Run the whole chronology from the CultLib checkout:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue