28 lines
1.0 KiB
Java
28 lines
1.0 KiB
Java
package com.ankurm.protocols;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
|
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
|
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
|
|
|
/**
|
|
* {@code @EnableWebSocket}, not {@code @EnableWebSocketMessageBroker}: this module wants the raw
|
|
* transport, with no broker in the path, so the benchmark measures a socket rather than a routing
|
|
* layer. The {@code sse-websocket} module in this repository is the STOMP version.
|
|
*/
|
|
@Configuration
|
|
@EnableWebSocket
|
|
public class WebSocketConfig implements WebSocketConfigurer {
|
|
|
|
private final WebSocketQuoteHandler handler;
|
|
|
|
WebSocketConfig(WebSocketQuoteHandler handler) {
|
|
this.handler = handler;
|
|
}
|
|
|
|
@Override
|
|
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
|
registry.addHandler(handler, "/quotes").setAllowedOriginPatterns("*");
|
|
}
|
|
}
|