The brass barrels inside the socket have a split side which usually spreads over the years causing the pins to fit loosely. But the barrels are encased in a rubber socket shape. On exposed two and three pin sockets such as Electrolux & GE I have had great success carefully squeezing the barrels closed with vice grips (or you can look for the split and force in two small nails 90 degrees to the split and squeeze them).
It's not so easy with sockets that are recessed and riveted internally to the vacuum body like Air-Way and Rainbow but if you can disassemble and get inside then the rivets can be popped and the same fix performed.
In a pinch, and being surrounded by molded rubber, a cut off nail inserted next to the barrel, forcing it closed, works too.
Last resort - install a new socket.
Dave