fix(matchmaking): deploy signal targets only the deploying player
Build & Deploy / build (push) Successful in 32s
Build & Deploy / build (push) Successful in 32s
EnterMatchmakingMatch broadcast OnSquadMatchmakingSuccess to Clients.All, so one player deploying pulled every connected player into the match. Map each player to their SignalR connection (GetSignalRConnection tags the URL with uid; CycleHub records it via a SignalRConnectionRegistry) and send the deploy signal only to that connection (broadcast fallback if unmapped). Also enable m_automaticImportPlatformFriends (Steam friends). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -24,13 +24,15 @@ public class EnterMatchmakingMatchFunction : ICloudScriptFunction<FYEnterMatchAz
|
||||
private readonly IHubContext<CycleHub> _hubContext;
|
||||
private readonly UserDataService _userDataService;
|
||||
private readonly TitleDataService _titleDataService;
|
||||
private readonly SignalRConnectionRegistry _registry;
|
||||
|
||||
public EnterMatchmakingMatchFunction(IHubContext<CycleHub> hubContext, IHttpContextAccessor httpContextAccessor, UserDataService userDataService, TitleDataService titleDataService)
|
||||
public EnterMatchmakingMatchFunction(IHubContext<CycleHub> hubContext, IHttpContextAccessor httpContextAccessor, UserDataService userDataService, TitleDataService titleDataService, SignalRConnectionRegistry registry)
|
||||
{
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_hubContext = hubContext;
|
||||
_userDataService = userDataService;
|
||||
_titleDataService = titleDataService;
|
||||
_registry = registry;
|
||||
}
|
||||
|
||||
public async Task<FYEnterMatchmakingResult> ExecuteAsync(FYEnterMatchAzureFunction request)
|
||||
@@ -94,11 +96,20 @@ public class EnterMatchmakingMatchFunction : ICloudScriptFunction<FYEnterMatchAz
|
||||
}
|
||||
);
|
||||
|
||||
await _hubContext.Clients.All.SendAsync("OnSquadMatchmakingSuccess", new OnSquadMatchmakingSuccessMessage {
|
||||
// Send the "matchmaking succeeded / travel to match" signal only to the deploying
|
||||
// player (via their mapped SignalR connection) — broadcasting to Clients.All made
|
||||
// every connected player travel too. Fall back to broadcast only if the connection
|
||||
// isn't mapped yet.
|
||||
var deployMessage = new OnSquadMatchmakingSuccessMessage {
|
||||
Success = true,
|
||||
SessionID = request.MapName, // TODO: Need to implement TryGetCompleteSquadInfo and pass squad info
|
||||
SessionID = request.MapName, // TODO: pass real squad session info
|
||||
SquadID = request.SquadId,
|
||||
});
|
||||
};
|
||||
var connectionId = _registry.GetConnection(userId);
|
||||
if (connectionId != null)
|
||||
await _hubContext.Clients.Client(connectionId).SendAsync("OnSquadMatchmakingSuccess", deployMessage);
|
||||
else
|
||||
await _hubContext.Clients.All.SendAsync("OnSquadMatchmakingSuccess", deployMessage);
|
||||
|
||||
return new FYEnterMatchmakingResult
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user