Implement roadmap phases 1 through 8
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using SpaceGame.Simulation.Api.Contracts;
|
||||
using SpaceGame.Simulation.Api.Simulation;
|
||||
using System.Text.Json;
|
||||
|
||||
@@ -31,7 +32,24 @@ app.MapGet("/api/world/stream", async (HttpContext httpContext, WorldService wor
|
||||
|
||||
var afterSequenceRaw = httpContext.Request.Query["afterSequence"].ToString();
|
||||
_ = long.TryParse(afterSequenceRaw, out var afterSequence);
|
||||
var stream = worldService.Subscribe(afterSequence, cancellationToken);
|
||||
var scopeKind = httpContext.Request.Query["scopeKind"].ToString();
|
||||
if (string.IsNullOrWhiteSpace(scopeKind))
|
||||
{
|
||||
scopeKind = httpContext.Request.Query["scope"].ToString();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(scopeKind))
|
||||
{
|
||||
scopeKind = "universe";
|
||||
}
|
||||
|
||||
var systemId = httpContext.Request.Query["systemId"].ToString();
|
||||
var bubbleId = httpContext.Request.Query["bubbleId"].ToString();
|
||||
var scope = new ObserverScope(
|
||||
scopeKind,
|
||||
string.IsNullOrWhiteSpace(systemId) ? null : systemId,
|
||||
string.IsNullOrWhiteSpace(bubbleId) ? null : bubbleId);
|
||||
var stream = worldService.Subscribe(scope, afterSequence, cancellationToken);
|
||||
|
||||
await httpContext.Response.WriteAsync(": connected\n\n", cancellationToken);
|
||||
await httpContext.Response.Body.FlushAsync(cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user