When you start servers in Companion, they are advertised over mDNS:
_http._tcp.local._ws._tcp.local.Both use instance name companion and host name companion.local..
When you start the HTTP server:
When you stop it, that HTTP service advertisement is removed.
The WebSocket server follows the same lifecycle for _ws._tcp.local. with your selected WebSocket port.
This page covers direct service advertisement.
For HTTP-side discovery of mDNS-advertised services, see mDNS HTTP Discovery Server.