Add the protocol-comparison module
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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("*");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user