On old rigs like my '61 Mack the jake brake is switched manually. You have to be sure to turn it off once you get close to engine idle rpms otherwise the engine will stall.
A quieter version called a bleeder brake which does the same thing though it leaves the exhaust valve slightly open during the entire compression stroke eliminating the popping sound. There is also the exhaust brake which puts a butterfly valve on the exhaust line creating back pressure when closed. Though the exhaust brake is known to cause problems with some valve train setups.
I typed a lot about this elsewhere, but essentially trucks have crappy brakes because of reasons (thermal ones, in large part) and as a result, in order to gather enough brake performance to not be extremely hazardous, they often must apply their engine brakes/jake brake/engine compression release brake in order to safely navigate with their loads in normal traffic or an emergency braking scenario (such as being cut off in midtown by some a-hole).
https://en.wikipedia.org/wiki/Compression_release_engine_bra...