List of usage examples for io.netty.handler.codec.http.websocketx.extensions.compression WebSocketServerCompressionHandler WebSocketServerCompressionHandler
public WebSocketServerCompressionHandler()
From source file:com.chuck.netty4.websocket.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslCtx != null) { pipeline.addLast(sslCtx.newHandler(ch.alloc())); }//from w w w . j a va 2s . c o m 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()); }
From source file:com.fanavard.challenge.server.websocket.server.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslCtx != null) { pipeline.addLast(sslCtx.newHandler(ch.alloc())); }/*w w w. j a v a 2 s .c o m*/ pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerHandler()); }
From source file:com.heliosapm.webrpc.server.RPCServer.java
License:Apache License
@Override protected void initChannel(final SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true)); pipeline.addLast(webSockServiceHandler); }
From source file:com.hop.hhxx.example.http.websocketx.server.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslCtx != null) { pipeline.addLast(sslCtx.newHandler(ch.alloc())); }/*from w w w.j a v a 2 s . c om*/ pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true)); pipeline.addLast(new io.netty.example.http.websocketx.server.WebSocketIndexPageHandler(WEBSOCKET_PATH)); pipeline.addLast(new WebSocketFrameHandler()); }
From source file:com.im.socket.netty.web.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerOnlyProtocolHandler(WEBSOCKET_PATH, null, true)); pipeline.addLast(new WebSocketFrameHandler()); // pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, // null, true)); // System.out.println("WebSocketServerInitializer"); }
From source file:com.im.test.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true)); pipeline.addLast(new WebSocketFrameHandler()); }
From source file:com.mpush.core.server.WebSocketServer.java
License:Apache License
@Override protected void initPipeline(ChannelPipeline pipeline) { pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(CC.mp.net.ws_path, null, true)); pipeline.addLast(new WebSocketIndexPageHandler()); pipeline.addLast(getChannelHandler()); }
From source file:com.zank.websocket.server.WebSocketServerInitializer.java
License:Apache License
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslCtx != null) { pipeline.addLast(sslCtx.newHandler(ch.alloc())); }//from ww w.j a v a 2 s . c o m pipeline.addLast("httpServerCodec", new HttpServerCodec()); pipeline.addLast("httpObjectAggregator", new HttpObjectAggregator(65536)); pipeline.addLast("compressionHandler", new WebSocketServerCompressionHandler()); pipeline.addLast("serverHandler", new ServerHandler()); pipeline.addLast("httpHandler", new HttpRequestHandler()); pipeline.addLast("websocketHandler", new WebsocketHandler()); //pipeline.addLast("httpRequestDecoder", new HttpRequestDecoder()); //pipeline.addLast("websocketRequestDecoder", new WebSocketRequstDecoder()); // pipeline.addLast("chatRoomHandler", new ChatRoomHandler(pool)); }
From source file:fr.kissy.zergling_push.MainServer.java
License:Apache License
private void run() throws Exception { final ChannelGroup allPlayers = new DefaultChannelGroup("AllPlayers", GlobalEventExecutor.INSTANCE); final ArrayBlockingQueue<PlayerMessage> messagesQueue = new ArrayBlockingQueue<PlayerMessage>(1024); final World world = new World(); final MainLoop mainLoop = new MainLoop(world, allPlayers, messagesQueue); ScheduledThreadPoolExecutor mainLoopExecutor = new ScheduledThreadPoolExecutor(1); mainLoopExecutor.scheduleAtFixedRate(mainLoop, 0, TICK_RATE, TimeUnit.MILLISECONDS); EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); EventExecutorGroup executorGroup = new DefaultEventExecutorGroup(16); try {//from w w w. j av a2 s. c o m final ServerBootstrap sb = new ServerBootstrap(); sb.childOption(ChannelOption.TCP_NODELAY, true); sb.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(final SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("http-decoder", new HttpServerCodec()); pipeline.addLast("http-aggregator", new HttpObjectAggregator(65536)); pipeline.addLast("websocket-compression", new WebSocketServerCompressionHandler()); pipeline.addLast("websocket-protocol", new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true)); pipeline.addLast(executorGroup, "flatbuffer-message", new FlatBufferMessageHandler(world, messagesQueue)); pipeline.addLast("http-server", new HttpStaticFileServerHandler()); } }).option(ChannelOption.SO_BACKLOG, 128).childOption(ChannelOption.SO_KEEPALIVE, true); final Channel ch = sb.bind(8080).sync().channel(); ch.closeFuture().sync(); } catch (Exception e) { throw new RuntimeException("Error while running server", e); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
From source file:io.enforcer.deathstar.ws.WebSocketServerInitializer.java
License:Apache License
/** * Initializes each communication channel and sets up the * channel pipeline//from w w w. j av a2 s .co m * * @param ch channel to initialize * @throws Exception if problems with channel setup */ @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerHandler()); allActiveChannels.add(ch); }