feat: Add PlayerReputation handling and WebSocket handshake for 2018 client

This commit is contained in:
Alexa
2026-06-08 01:27:08 +03:00
parent 2eba82b342
commit da596a2692
3 changed files with 36 additions and 0 deletions
@@ -26,5 +26,6 @@ public static class Player2018Mapper
ProfileImageName = p.ProfileImageName ?? string.Empty,
JuniorProfile = p.IsJunior,
HasBirthday = p.Birthday.HasValue,
PlayerReputation = new PlayerReputation2018 { Noteriety = p.Reputation },
};
}
@@ -37,6 +37,17 @@ public class NotificationController(
using var ws = await HttpContext.WebSockets.AcceptWebSocketAsync();
log.LogInformation("[notify] 2018 client opened notification WebSocket");
// HANDSHAKE: on connect the 2018 client enters PerformingHandshake and
// blocks ("Connecting to RecNet") until the SERVER sends a handshake
// message — any valid JSON object marks the channel Connected
// (RecNet.cs:49616-49620, JFBBMEIDBNA just needs dict != null). Without
// it both sides wait for each other ~35s, then the client aborts the
// channel and shows "Failed to connect to RecNet". Send {} immediately.
var handshake = System.Text.Encoding.UTF8.GetBytes("{}");
await ws.SendAsync(handshake, WebSocketMessageType.Text, endOfMessage: true,
HttpContext.RequestAborted);
var buf = new byte[4096];
try
{