WebSocket is a different thing, despite the similar name
Despite the name, "WebSocket" isn't the operating-system-level socket described on this page -- it's a separate application-layer protocol built specifically so a browser and a server can hold open a persistent, two-way connection, commonly used for chat apps and live updates. A WebSocket connection is actually built on top of an ordinary TCP socket underneath.
Sockets, firewalls, and port forwarding are the same idea from different angles
A firewall rule that blocks a port is really preventing new sockets from forming on that port, and port forwarding works by redirecting incoming socket connections on a router to a specific device inside the network. Once the socket concept clicks, these related networking topics stop feeling like separate rules to memorize.
Frequently Asked Questions
Do I ever need to choose my own socket number?
No. A server's well-known ports (like 80 or 443) are set by the program or an administrator, but the temporary port your device uses as a client is assigned automatically by the operating system, so there's nothing for you to configure.
Can a server run out of sockets?
Yes -- a server that opens and closes a very large number of connections in a short time can temporarily run out of available ephemeral ports, a condition sometimes called socket exhaustion. This is often mitigated by tuning connection reuse (keep-alive) settings on the server.