/// <summary> /// Sends text message. /// </summary> /// <param name="text"></param> /// <returns></returns> internal async Task SendText(string text) { LCLogger.Debug($"{id} => {text}"); Task sendTask = client.Send(text); if (await Task.WhenAny(sendTask, Task.Delay(SEND_TIMEOUT)) == sendTask) { await sendTask; } else { throw new TimeoutException("Send request time out"); } }
internal async Task SendCommand(GenericCommand command) { LCLogger.Debug($"{id} => {FormatCommand(command)}"); byte[] bytes = command.ToByteArray(); Task sendTask = ws.Send(bytes); if (await Task.WhenAny(sendTask, Task.Delay(SEND_TIMEOUT)) == sendTask) { await sendTask; } else { throw new TimeoutException("Send request"); } }