Files
h-school/src/HSchool.Protocol/ProtocolConstants.cs
T
Leonid PershinandCursor 1a21a64b4b Bump protocol to v9 and carry talk-circle ids on the presence frame.
Names stay off the wire; a person not in a circle writes an empty member list and topic.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 10:42:11 +03:00

22 lines
979 B
C#

namespace HSchool.Protocol;
/// <summary>Wire-format constants shared by the server and the browser client.</summary>
public static class ProtocolConstants
{
/// <summary>Bumped on every breaking change to the binary layout.</summary>
public const byte Version = 9;
/// <summary>Upper bound for a single WebSocket frame accepted by the server.</summary>
public const int MaxMessageSize = 8 * 1024;
/// <summary>Hello locale byte: Russian. Any other value that is not <see cref="LocaleEnglish"/> is treated as this.</summary>
public const byte LocaleRussian = 0;
/// <summary>Hello locale byte: English. Same value the catalog HTTP API takes as <c>lang=en</c>.</summary>
public const byte LocaleEnglish = 1;
/// <summary>Catalog locale string matching the Hello byte. Unknown bytes fall back to Russian.</summary>
public static string CatalogLocale(byte locale) =>
locale == LocaleEnglish ? "en" : "ru";
}