Skip to content

Commit

Permalink
[CastIt.Server] Some server messages must be sent to the caller inste…
Browse files Browse the repository at this point in the history
…ad of all connected devices
  • Loading branch information
Wolfteam committed May 2, 2022
1 parent ef640bb commit f2ef62c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions CastIt.Server/Hubs/CastItHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public CastItHub(

public override async Task OnConnectedAsync()
{
await SendSettingsChanged();
await SendSettingsChanged(false);
if (_castService.IsPlayingOrPaused)
{
await SendPlayerStatusChanged();
await SendPlayerStatusChanged(false);
}
await SendPlayListsToClient();
await SendCastDevicesChanged();
await SendCastDevicesChanged(false);
}

#region Client Msgs
Expand Down Expand Up @@ -410,27 +410,27 @@ public Task SendFileLoaded(FileItemResponseDto file)
return Clients.All.FileLoaded(file);
}

public Task SendPlayerStatusChanged()
public Task SendPlayerStatusChanged(bool all = true)
{
var status = _castService.GetPlayerStatus();
return Clients.All.PlayerStatusChanged(status);
return all ? Clients.All.PlayerStatusChanged(status) : Clients.Caller.PlayerStatusChanged(status);
}

public Task SendEndReached(FileItemResponseDto file)
{
return Clients.All.FileEndReached(file);
}

public Task SendCastDevicesChanged()
public Task SendCastDevicesChanged(bool all = true)
{
var devices = _castService.AvailableDevices;
return Clients.All.CastDevicesChanged(devices);
return all ? Clients.All.CastDevicesChanged(devices) : Clients.Caller.CastDevicesChanged(devices);
}

public Task SendSettingsChanged()
public Task SendSettingsChanged(bool all = true)
{
var settings = _settingsService.Settings;
return Clients.All.PlayerSettingsChanged(settings);
return all ? Clients.All.PlayerSettingsChanged(settings) : Clients.Caller.PlayerSettingsChanged(settings);
}

public Task SendServerMessage(AppMessageType type)
Expand Down

0 comments on commit f2ef62c

Please sign in to comment.