Search in sources :

Example 1 with WebSocketHandlerAdapter

use of org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter in project spring-framework by spring-projects.

the class WebFluxConfigurationSupport method webFluxWebSocketHandlerAdapter.

@Bean
public WebSocketHandlerAdapter webFluxWebSocketHandlerAdapter() {
    WebSocketHandlerAdapter adapter = new WebSocketHandlerAdapter(initWebSocketService());
    // Lower the (default) priority for now, for backwards compatibility
    int defaultOrder = adapter.getOrder();
    adapter.setOrder(defaultOrder + 1);
    return adapter;
}
Also used : WebSocketHandlerAdapter(org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter) Bean(org.springframework.context.annotation.Bean)

Example 2 with WebSocketHandlerAdapter

use of org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter in project spring-framework by spring-projects.

the class DelegatingWebFluxConfigurationTests method webSocketService.

@Test
void webSocketService() {
    WebSocketService service = mock(WebSocketService.class);
    given(webFluxConfigurer.getWebSocketService()).willReturn(service);
    delegatingConfig.setConfigurers(Collections.singletonList(webFluxConfigurer));
    WebSocketHandlerAdapter adapter = delegatingConfig.webFluxWebSocketHandlerAdapter();
    assertThat(adapter.getWebSocketService()).isSameAs(service);
}
Also used : WebSocketHandlerAdapter(org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter) WebSocketService(org.springframework.web.reactive.socket.server.WebSocketService) Test(org.junit.jupiter.api.Test)

Aggregations

WebSocketHandlerAdapter (org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter)2 Test (org.junit.jupiter.api.Test)1 Bean (org.springframework.context.annotation.Bean)1 WebSocketService (org.springframework.web.reactive.socket.server.WebSocketService)1