/// <summary> /// Sends a message to ALL connected clients. /// </summary> /// <param name="command">the message to send</param> public async Task BroadcastCommandAsync(LightSwitchCommand command) { foreach (var client in GetSafeClients()) { await SendLightSwitchCommand(client, command); } }
private async Task SendLightSwitchCommand(LightSwitchClient lightSwitchClient, LightSwitchCommand lightSwitchCommand) { var sendCommandResult = await lightSwitchClient.SendCommandAsync(lightSwitchCommand); if (sendCommandResult.HasError) { await Log.ReportErrorAsync(sendCommandResult.Message, CancellationToken); } }