Search in sources :

Example 1 with HandshakeComplete

use of io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler.HandshakeComplete in project netty by netty.

the class StompWebSocketProtocolCodec method userEventTriggered.

@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
    if (evt instanceof WebSocketServerProtocolHandler.HandshakeComplete) {
        StompVersion stompVersion = StompVersion.findBySubProtocol(((HandshakeComplete) evt).selectedSubprotocol());
        ctx.channel().attr(StompVersion.CHANNEL_ATTRIBUTE_KEY).set(stompVersion);
        ctx.pipeline().addLast(new WebSocketFrameAggregator(65536)).addLast(new StompSubframeDecoder()).addLast(new StompSubframeAggregator(65536)).addLast(stompChatHandler).remove(StompWebSocketClientPageHandler.INSTANCE);
    } else {
        super.userEventTriggered(ctx, evt);
    }
}
Also used : WebSocketFrameAggregator(io.netty.handler.codec.http.websocketx.WebSocketFrameAggregator) HandshakeComplete(io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler.HandshakeComplete) StompSubframeDecoder(io.netty.handler.codec.stomp.StompSubframeDecoder) StompSubframeAggregator(io.netty.handler.codec.stomp.StompSubframeAggregator)

Aggregations

WebSocketFrameAggregator (io.netty.handler.codec.http.websocketx.WebSocketFrameAggregator)1 HandshakeComplete (io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler.HandshakeComplete)1 StompSubframeAggregator (io.netty.handler.codec.stomp.StompSubframeAggregator)1 StompSubframeDecoder (io.netty.handler.codec.stomp.StompSubframeDecoder)1