/// <summary> /// Sends asynchronously the packet to a specific client. /// </summary> /// <param name="clientIndex">Index of the client.</param> /// <param name="pBufferToSend"></param> /// <param name="numBytesToSend"></param> public void Send(uint clientIndex, byte[] pBufferToSend, int numBytesToSend, bool isWebSocketClient) { try { MqttClient c = GetClientByIndex(clientIndex, isWebSocketClient); if (!c.IsWebSocketClient) { tcpServer.Send(clientIndex, pBufferToSend); } else { wsServer.Send(clientIndex, pBufferToSend); } } catch (Exception e) { CrestronLogger.WriteToLog("MQTTSERVER - Send - Exception occured trying to send data message : " + e.Message, 8); CrestronLogger.WriteToLog("MQTTSERVER - Send - Exception occured trying to send data stack trace : " + e.StackTrace, 8); } }