How do I install a light socket in the middle of a power line with a switch?
You put the switch and the light fixture both between hot &amp; neutral, effectively parallel to each other. That makes the light always on and the switch creates a short between hot &amp; neutral - correctly tripping the breaker.
What you have is a switch loop. They are confusing at first but actually quite simple.
Light switches are normally wired in the &quot;middle&quot; of the hot wire between the power source and the light. The way you do that with a switch loop is as follows:

Black from power (hot) connects (yes this will seem strange) to the white wire going to the switch. It bypasses the light fixture.
White from power (neutral) connects to the silver screw on the light fixture.
Black from the switch goes to the brass screw on the light fixture. This is called switched hot.

This uses the same wires you already have, just arranged slightly differently. Plus you need one more wire nut to connect the black power wire to the white switch wire.
In order to avoid future confusion, you should put colored electrical tape (not green or white) near both ends of that white switch loop wire to indicate that it is a hot wire.

As noted in a comment on the question, you may want to preemptively replace the switch as it may have been damaged by arcing from shorting. If you do that (or if you replace it sometime later for any other reason), keep in mind that a traditional switch loop does not have neutral. That rules out many, but not all, options for timers, lighted switches, dimmers, smart switches, etc. If you put in anything other than a simple switch, make sure that it does not require neutral.