diff --git a/src/GameCult.Mesh/CultMeshClient.cs b/src/GameCult.Mesh/CultMeshClient.cs index d07ef1a3..64fd4c3b 100644 --- a/src/GameCult.Mesh/CultMeshClient.cs +++ b/src/GameCult.Mesh/CultMeshClient.cs @@ -173,6 +173,7 @@ namespace GameCult.Mesh using var snapshot = await CultMeshSnapshotSession.ConnectAsync( _sessions, CultMeshEndpointId.Parse(endpointId), + CultMeshProtocols.Content, new CultMeshSnapshotRequestOptions { ConnectTimeout = TimeSpan.FromSeconds(5), diff --git a/src/GameCult.Mesh/CultMeshSessions.cs b/src/GameCult.Mesh/CultMeshSessions.cs index db2d8a9e..806f0405 100644 --- a/src/GameCult.Mesh/CultMeshSessions.cs +++ b/src/GameCult.Mesh/CultMeshSessions.cs @@ -34,6 +34,7 @@ namespace GameCult.Mesh public static class CultMeshProtocols { public static CultMeshProtocolId Documents { get; } = new CultMeshProtocolId("cultmesh.documents.v1"); + public static CultMeshProtocolId Content { get; } = new CultMeshProtocolId("cultmesh.content.v1"); public static CultMeshProtocolId Discovery { get; } = new CultMeshProtocolId("cultmesh.discovery.v1"); public static CultMeshProtocolId PeerExchange { get; } = new CultMeshProtocolId("cultmesh.peer_exchange.v1"); public static CultMeshProtocolId Subscriptions { get; } = new CultMeshProtocolId("cultmesh.subscriptions.v1"); diff --git a/src/GameCult.Mesh/CultMeshSnapshots.cs b/src/GameCult.Mesh/CultMeshSnapshots.cs index 1e9996e1..03fc4aad 100644 --- a/src/GameCult.Mesh/CultMeshSnapshots.cs +++ b/src/GameCult.Mesh/CultMeshSnapshots.cs @@ -122,6 +122,19 @@ namespace GameCult.Mesh return new CultMeshSnapshotSession(session, options ?? new CultMeshSnapshotRequestOptions(), registry); } + public static async Task ConnectAsync( + CultMeshSessionManager sessions, + CultMeshEndpointId endpointId, + CultMeshProtocolId protocol, + CultMeshSnapshotRequestOptions options, + CultNetDocumentRegistry? registry = null, + CancellationToken cancellationToken = default) + { + if (sessions == null) throw new ArgumentNullException(nameof(sessions)); + var session = await sessions.ConnectAsync(endpointId, protocol, cancellationToken).ConfigureAwait(false); + return new CultMeshSnapshotSession(session, options ?? new CultMeshSnapshotRequestOptions(), registry); + } + /// Fetches one raw snapshot while retaining the underlying endpoint connection. public async Task FetchSnapshotAsync( IReadOnlyList? schemaIds = null,