private static async Task SendErrorMessageForInvalidCommandsAsync(WebSocket webSocket) { var errorMessage = new ErrorMessage(ErrorType.CommandError, "Command could not be parsed into Prusa CLI Command Object. Check JSON format.").ToString(); var errorMessageBytes = Encoding.ASCII.GetBytes(errorMessage); await webSocket.SendAsync(new ArraySegment <byte>(errorMessageBytes, 0, errorMessage.Length), WebSocketMessageType.Text, true, CancellationToken.None); }
private async Task SendErrorMessageForInvalidProfile(WebSocket webSocket) { var errorMessage = new ErrorMessage(ErrorType.InvalidProfile, "Invalid profile selected").ToString(); var errorMessageBytes = Encoding.ASCII.GetBytes(errorMessage); await webSocket.SendAsync(new ArraySegment <byte>(errorMessageBytes, 0, errorMessage.Length), WebSocketMessageType.Text, true, CancellationToken.None); }