This commit is contained in:
Ryan Peters 2024-01-17 20:21:35 -05:00
parent ba120bfa24
commit 88bbbc5e91

View File

@ -8,6 +8,8 @@ namespace BinaryDad.Coding.Hubs
{
public Task UpdateCode(string user, int index, string code, bool isTeacher)
{
Console.WriteLine($"Received code from {user} with index {index}");
if (index == 0)
{
if (Users.Sessions.TryGetValue(Context.ConnectionId, out User value))
@ -26,9 +28,13 @@ namespace BinaryDad.Coding.Hubs
// only send to all if it's a teacher
if (isTeacher)
{
Console.WriteLine($"Sending code from {user}");
return Clients.All.SendAsync("ReceiveCode", user, index, code);
}
return Task.CompletedTask;
}