Search in sources :

Example 6 with WebSocketServerProtocolHandler

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

the class WebSocketServerInitializer method initChannel.

@Override
public void initChannel(SocketChannel ch) throws Exception {
    ChannelPipeline pipeline = ch.pipeline();
    if (sslCtx != null) {
        pipeline.addLast(sslCtx.newHandler(ch.alloc()));
    }
    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast(new HttpObjectAggregator(65536));
    pipeline.addLast(new WebSocketServerCompressionHandler());
    pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
    pipeline.addLast(new WebSocketIndexPageHandler(WEBSOCKET_PATH));
    pipeline.addLast(new WebSocketFrameHandler());
}
Also used : HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) WebSocketServerCompressionHandler(io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler) HttpServerCodec(io.netty.handler.codec.http.HttpServerCodec) WebSocketServerProtocolHandler(io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler) ChannelPipeline(io.netty.channel.ChannelPipeline)

Example 7 with WebSocketServerProtocolHandler

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

the class SampleWebSocketPushChannelInitializer method addPushHandlers.

@Override
protected void addPushHandlers(final ChannelPipeline pipeline) {
    pipeline.addLast(PushAuthHandler.NAME, pushAuthHandler);
    pipeline.addLast(new WebSocketServerCompressionHandler());
    pipeline.addLast(new WebSocketServerProtocolHandler(PushProtocol.WEBSOCKET.getPath(), null, true));
    pipeline.addLast(new PushRegistrationHandler(pushConnectionRegistry, PushProtocol.WEBSOCKET));
    pipeline.addLast(new SampleWebSocketPushClientProtocolHandler());
}
Also used : WebSocketServerCompressionHandler(io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler) WebSocketServerProtocolHandler(io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler)

Aggregations

WebSocketServerProtocolHandler (io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler)7 ChannelPipeline (io.netty.channel.ChannelPipeline)6 HttpObjectAggregator (io.netty.handler.codec.http.HttpObjectAggregator)6 HttpServerCodec (io.netty.handler.codec.http.HttpServerCodec)6 WebSocketServerCompressionHandler (io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketServerCompressionHandler)3 ChunkedWriteHandler (io.netty.handler.stream.ChunkedWriteHandler)3 WebSocketFrameAggregator (io.netty.handler.codec.http.websocketx.WebSocketFrameAggregator)1 LoggingHandler (io.netty.handler.logging.LoggingHandler)1 SslContext (io.netty.handler.ssl.SslContext)1 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)1 WSConfig (io.transport.core.config.Configuration.WSConfig)1 File (java.io.File)1 WebSocketFrameTranslator (org.neo4j.bolt.transport.pipeline.WebSocketFrameTranslator)1