Search in sources :

Example 1 with UndertowWebSocketHandlerAdapter

use of org.springframework.web.reactive.socket.adapter.UndertowWebSocketHandlerAdapter in project spring-framework by spring-projects.

the class UndertowWebSocketClient method handleChannel.

private void handleChannel(URI url, WebSocketHandler handler, MonoProcessor<Void> completion, DefaultNegotiation negotiation, WebSocketChannel channel) {
    HandshakeInfo info = afterHandshake(url, negotiation.getResponseHeaders());
    UndertowWebSocketSession session = new UndertowWebSocketSession(channel, info, bufferFactory, completion);
    UndertowWebSocketHandlerAdapter adapter = new UndertowWebSocketHandlerAdapter(session);
    channel.getReceiveSetter().set(adapter);
    channel.resumeReceives();
    handler.handle(session).subscribe(session);
}
Also used : UndertowWebSocketSession(org.springframework.web.reactive.socket.adapter.UndertowWebSocketSession) HandshakeInfo(org.springframework.web.reactive.socket.HandshakeInfo) UndertowWebSocketHandlerAdapter(org.springframework.web.reactive.socket.adapter.UndertowWebSocketHandlerAdapter)

Example 2 with UndertowWebSocketHandlerAdapter

use of org.springframework.web.reactive.socket.adapter.UndertowWebSocketHandlerAdapter in project spring-framework by spring-projects.

the class UndertowWebSocketClient method handleChannel.

private void handleChannel(URI url, WebSocketHandler handler, Sinks.Empty<Void> completionSink, DefaultNegotiation negotiation, WebSocketChannel channel) {
    HandshakeInfo info = createHandshakeInfo(url, negotiation);
    DataBufferFactory bufferFactory = DefaultDataBufferFactory.sharedInstance;
    UndertowWebSocketSession session = new UndertowWebSocketSession(channel, info, bufferFactory, completionSink);
    UndertowWebSocketHandlerAdapter adapter = new UndertowWebSocketHandlerAdapter(session);
    channel.getReceiveSetter().set(adapter);
    channel.resumeReceives();
    handler.handle(session).checkpoint(url + " [UndertowWebSocketClient]").subscribe(session);
}
Also used : UndertowWebSocketSession(org.springframework.web.reactive.socket.adapter.UndertowWebSocketSession) DefaultDataBufferFactory(org.springframework.core.io.buffer.DefaultDataBufferFactory) DataBufferFactory(org.springframework.core.io.buffer.DataBufferFactory) HandshakeInfo(org.springframework.web.reactive.socket.HandshakeInfo) UndertowWebSocketHandlerAdapter(org.springframework.web.reactive.socket.adapter.UndertowWebSocketHandlerAdapter)

Aggregations

HandshakeInfo (org.springframework.web.reactive.socket.HandshakeInfo)2 UndertowWebSocketHandlerAdapter (org.springframework.web.reactive.socket.adapter.UndertowWebSocketHandlerAdapter)2 UndertowWebSocketSession (org.springframework.web.reactive.socket.adapter.UndertowWebSocketSession)2 DataBufferFactory (org.springframework.core.io.buffer.DataBufferFactory)1 DefaultDataBufferFactory (org.springframework.core.io.buffer.DefaultDataBufferFactory)1