private void updatePipeline(ChannelHandlerContext ctx) {
ChannelPipeline p = ctx.pipeline();
ChannelHandlerContext nettyEncoderCtx = p.context(WebSocketFrameEncoder.class);
p.addAfter(nettyEncoderCtx.name(), "websocket-write-metrics", new ServerWriteMetricsHandler(eventsSubject));
ChannelHandlerContext nettyDecoderCtx = p.context(WebSocketFrameDecoder.class);
p.addAfter(nettyDecoderCtx.name(), "websocket-read-metrics", new ServerReadMetricsHandler(eventsSubject));
if (messageAggregator) {
p.addAfter("websocket-read-metrics", "websocket-frame-aggregator", new WebSocketFrameAggregator(maxFramePayloadLength));
}
p.remove(this);
}