spring-framework / org.springframework.web.socket.config.annotation / WebSocketHandlerRegistration

WebSocketHandlerRegistration

interface WebSocketHandlerRegistration

Provides methods for configuring a WebSocket handler.

Author
Rossen Stoyanchev

Since
4.0

Functions

addHandler

abstract fun addHandler(handler: WebSocketHandler, vararg paths: String): WebSocketHandlerRegistration

Add more handlers that will share the same configuration (interceptors, SockJS config, etc)

addInterceptors

abstract fun addInterceptors(vararg interceptors: HandshakeInterceptor): WebSocketHandlerRegistration

Configure interceptors for the handshake request.

setAllowedOrigins

abstract fun setAllowedOrigins(vararg origins: String): WebSocketHandlerRegistration

Configure allowed Origin header values. This check is mostly designed for browser clients. There is nothing preventing other types of client to modify the Origin header value.

When SockJS is enabled and origins are restricted, transport types that do not allow to check request origin (JSONP and Iframe based transports) are disabled. As a consequence, IE 6 to 9 are not supported when origins are restricted.

Each provided allowed origin must start by "http://", "https://" or be "*" (means that all origins are allowed). By default, only same origin requests are allowed (empty list).

setHandshakeHandler

abstract fun setHandshakeHandler(handshakeHandler: HandshakeHandler): WebSocketHandlerRegistration

Configure the HandshakeHandler to use.

withSockJS

abstract fun withSockJS(): SockJsServiceRegistration

Enable SockJS fallback options.

Inheritors

AbstractWebSocketHandlerRegistration

abstract class AbstractWebSocketHandlerRegistration<M : Any> : WebSocketHandlerRegistration

Base class for WebSocketHandlerRegistrations that gathers all the configuration options but allows sub-classes to put together the actual HTTP request mappings.