Drain and press water from onions. Place most of the pre-soaked onions in the machine with the rest of the ingredients. Save the rest to sprinkle on top of the bagels before baking.
Insert ingredients in bread machine according to manufacturer's instructions. Remove the dough from the machine after the first knead -- approximately 20 to 30 minutes.
Place dough on a floured surface. Divide into equal parts. Form balls, gently press thumb through center of ball and slowly stretch into bagel shape.
While bagels rise, bring three quarts of water and one tablespoon of sugar to a rapid boil in a large saucepan. Drop test dough (see hints below).
Using a slotted spoon, drop 2-3 bagels into rapidly boiling water. Boil on each side for 1/2 minutes. Remove and cool on rack 1 minute, brush with egg and sprinkle with sesame or poppy seeds, if desired.
Bake at 400 degrees F on a baking sheet sprinkled with cornmeal, until golden, approximately 15 minutes.
HINT: When forming the bagels, set aside two 1/4" balls of dough. When the bagels have doubled in size, drop the test dough into boiling water. The dough should pop to the top right away. When this happens, it is time to boil the bagels.
NOTE: A quick spray of non-stick vegetable coating on the top of the bagel may be substituted for the egg wash.