Authentication: Custom headers can include authentication tokens (e.g., JWTs, API keys) that are necessary to authenticate users or devices before establishing a connection.
Custom Protocols: In some use cases, clients and servers might follow proprietary or custom protocols that require specific headers to establish a connection or negotiate terms (for example vmware cloud director requires to set header Sec-WebSocket-Protocol to mqtt to establish a WebSocket connection).
Motivation
Authentication: Custom headers can include authentication tokens (e.g., JWTs, API keys) that are necessary to authenticate users or devices before establishing a connection.
Custom Protocols: In some use cases, clients and servers might follow proprietary or custom protocols that require specific headers to establish a connection or negotiate terms (for example vmware cloud director requires to set header Sec-WebSocket-Protocol to mqtt to establish a WebSocket connection).