spring-framework / org.springframework.web.socket.server.support / AbstractHandshakeHandler / setSupportedProtocols

setSupportedProtocols

open fun setSupportedProtocols(vararg protocols: String): Unit

Use this property to configure the list of supported sub-protocols. The first configured sub-protocol that matches a client-requested sub-protocol is accepted. If there are no matches the response will not contain a Sec-WebSocket-Protocol header.

Note that if the WebSocketHandler passed in at runtime is an instance of SubProtocolCapable then there is not need to explicitly configure this property. That is certainly the case with the built-in STOMP over WebSocket support. Therefore this property should be configured explicitly only if the WebSocketHandler does not implement SubProtocolCapable.