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>
22 lines
979 B
C#
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";
|
|
}
|