What are WebSocket subprotocols?

Updated May 6, 2026

Short answer

Subprotocols define application-level protocols over WebSocket.

Deep explanation

They allow client and server to agree on message formats like JSON, STOMP, or custom protocols during handshake.

Real-world example

Using STOMP for messaging systems.

Common mistakes

  • Ignoring subprotocol negotiation.

Follow-up questions

  • What is STOMP?

More WebSockets interview questions

View all →