Java Code Examples for org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry

Following code examples demonstrate how to use org.springframework.web.socket.config.annotation.WebSocketHandlerRegistryfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.web.socket.config.annotation.WebSocketHandlerRegistryand various code implementation of this class.

	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(echoHandler(), "/echo")
			.setAllowedOrigins("*");
	} 


	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {

		registry.addHandler(chatWebSocketHandler(), "/chat/chat-handler")
				.addInterceptors(new HttpSessionHandshakeInterceptor());

		
		
	} 

	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(myHandler(), "/testHandler").addInterceptors(new WebSocketInterceptor());
		registry.addHandler(myHandler(), "/socketJs/testHandler").addInterceptors(new WebSocketInterceptor())
				.withSockJS();

	} 

Advertisement
Javadoc
Provides methods for configuring WebSocketHandler request mappings. @author Rossen Stoyanchev @since

4.0

Read More
Advertisement