Skip to main content

12. Using the WebSocket Protocol from Other Specifications

Other specifications can reference the WebSocket Protocol to define their communication mechanisms.

Subprotocols​

Specifications can define subprotocols on top of WebSocket:

Example: STOMP over WebSocket

Sec-WebSocket-Protocol: stomp

Extensions​

Specifications can define WebSocket extensions:

Example: RFC 7692 (WebSocket Compression Extensions)

Best Practices​

  1. Clearly specify subprotocol name
  2. Define message format
  3. Define error handling
  4. Consider security