If I were you, I’d check out the ShooterGame. It’s a C++ project, but the general approach is the same regardless of whether you’re using BP or C++.
Essentially, yes, you parent a skeletal mesh to the socket, and you have animations on the gun mesh. Usually, you wouldn’t just attach a bare mesh, you’d create a weapon object that’s a subclass of AActor with a USkeletalMeshComponent. You might then have subclasses for different weapons or different types of weapons with different properties, animations, etc…
For your character’s inventory, you could store an array of weapons, and when you set the active weapon, you attack the weapon’s skeletal mesh to the character’s weapon socket.
Here’s a video tutorial (might be a bit outdated now) that shows how to add a weapon to the FPS template: Unreal Engine 4 Tutorial: Custom Weapon (english) - YouTube
Haven’t watched it, but the videos from that guy are usually pretty good.