Classroom Kick problem

This commit is contained in:
Sedat Öztürk 2025-08-31 22:24:06 +03:00
parent 0db26ba738
commit cba9bdf228
2 changed files with 7 additions and 6 deletions

View file

@ -422,6 +422,9 @@ public class ClassroomHub : Hub
await Clients.Client(connectionId) await Clients.Client(connectionId)
.SendAsync("ForceDisconnect", "You have been removed from the class."); .SendAsync("ForceDisconnect", "You have been removed from the class.");
// 🔑 Mesajın clienta ulaşmasını bekle
await Task.Delay(200);
await Groups.RemoveFromGroupAsync(connectionId, sessionId.ToString()); await Groups.RemoveFromGroupAsync(connectionId, sessionId.ToString());
} }
@ -567,11 +570,10 @@ public class ClassroomHub : Hub
participant.IsActive = false; participant.IsActive = false;
participant.ConnectionId = null; participant.ConnectionId = null;
await _participantRepository.UpdateAsync(participant, autoSave: true); await _participantRepository.UpdateAsync(participant, autoSave: true);
}
// 🔑 Frontende bildir await Clients.Group(participant.SessionId.ToString())
await Clients.Group(participant.SessionId.ToString()) .SendAsync("ParticipantLeft", new { UserId = userId.Value, SessionId = participant.SessionId });
.SendAsync("ParticipantLeft", new { UserId = userId.Value, SessionId = participant.SessionId }); }
} }
} }

View file

@ -143,8 +143,7 @@ export class SignalRService {
}) })
this.connection.on('ForceDisconnect', async (message: string) => { this.connection.on('ForceDisconnect', async (message: string) => {
console.warn('⚠️ ForceDisconnect received:', message) console.warn('🚨 ForceDisconnect geldi:', message)
this.isKicked = true this.isKicked = true
if (this.onForceCleanup) { if (this.onForceCleanup) {