Class YHocuspocusWebSocketConfigurer.Builder
java.lang.Object
net.carcdr.yhocuspocus.spring.websocket.YHocuspocusWebSocketConfigurer.Builder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInterceptor(org.springframework.web.socket.server.HandshakeInterceptor interceptor) Adds a handshake interceptor.allowedOrigins(String... origins) Sets the allowed origins for CORS.build()Builds the configurer.Sets the WebSocket endpoint path.server(net.carcdr.yhocuspocus.core.YHocuspocus server) Sets the YHocuspocus server (required).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
server
public YHocuspocusWebSocketConfigurer.Builder server(net.carcdr.yhocuspocus.core.YHocuspocus server) Sets the YHocuspocus server (required).- Parameters:
server- the server instance- Returns:
- this builder
-
path
Sets the WebSocket endpoint path.- Parameters:
path- the path (must start with '/')- Returns:
- this builder
- Throws:
IllegalArgumentException- if path is null or doesn't start with '/'
-
allowedOrigins
Sets the allowed origins for CORS.- Parameters:
origins- allowed origins (use "*" for all)- Returns:
- this builder
-
addInterceptor
public YHocuspocusWebSocketConfigurer.Builder addInterceptor(org.springframework.web.socket.server.HandshakeInterceptor interceptor) Adds a handshake interceptor.Interceptors can be used for authentication, adding session attributes, and other pre-connection logic.
- Parameters:
interceptor- the interceptor to add- Returns:
- this builder
-
build
Builds the configurer.- Returns:
- new YHocuspocusWebSocketConfigurer instance
- Throws:
IllegalStateException- if server is not set
-