Shared workers use .port because they support multiple clients (scripts or tabs) and each connection requires a unique MessagePort for bidirectional communication. The MessagePort allows the worker to distinguish messages from different clients. Dedicated workers, on the other hand, are tied to a single client, so they don't need .port. Communication with a dedicated worker happens directly through the Worker instance.
Jeff Tillwick
I'd like to know why the shared worker uses .port and the external worker does not. What is the logic there?