Protein skimmers are commonly used in saltwater tanks. A foam is generated in a container via air stone or water pump. Proteins and other substances (surfactants) accumulate in the foam. The excess foam is pushed into a collection cup.
The use of protein skimmers in freshwater is not unheard of, however, it is not very efficient compared to saltwater.