Update wire protocol to version 7 and enhance presence management features
- Bumped the wire protocol version to 7, reflecting significant changes in the communication structure. - Introduced a new presence message type for real-time occupancy updates, including node activity and individual presence states. - Updated the API to include a directory endpoint for fetching short id→name mappings, improving client-side name resolution. - Revised the map snapshot structure to be static, with people and current lessons now handled through the presence stream. - Enhanced client-side handling of presence updates, including UI adjustments to display live occupancy and activity. - Updated documentation to reflect the new protocol features and changes in presence management. - Added tests to validate the new presence functionalities and ensure robust handling of real-time data.
This commit is contained in:
@@ -134,6 +134,29 @@ internal static class SchoolEndpoints
|
||||
})
|
||||
.WithName("GetSchoolPeople");
|
||||
|
||||
schools.MapGet("/{id:int}/directory", (int id, string? lang, GameLoopService loop) =>
|
||||
{
|
||||
var published = loop.FindPeople(id);
|
||||
if (published is null)
|
||||
{
|
||||
return Problem(StatusCodes.Status404NotFound, "unknown-school", "That school does not exist.");
|
||||
}
|
||||
|
||||
_ = ParseLocale(lang);
|
||||
var roster = published.Roster;
|
||||
if (roster is null)
|
||||
{
|
||||
return Results.Ok(new DirectoryResponse([]));
|
||||
}
|
||||
|
||||
var people = roster.People
|
||||
.OrderBy(person => person.Id, StringComparer.Ordinal)
|
||||
.Select(person => new DirectoryPersonResponse(person.Id, person.Name.Full))
|
||||
.ToArray();
|
||||
return Results.Ok(new DirectoryResponse(people));
|
||||
})
|
||||
.WithName("GetSchoolDirectory");
|
||||
|
||||
schools.MapGet("/{id:int}/people/{personId}", async (
|
||||
int id,
|
||||
string personId,
|
||||
|
||||
Reference in New Issue
Block a user