public static void addIfFeatureEnabled(IoFilterChain filterChain, String filterName, long inactivityTimeoutIn, Logger logger) { addIfFeatureEnabled(filterChain, filterName, inactivityTimeoutIn, null, logger); }
private void addSession0(IoSessionEx wsebSession) { if (ALREADY_TRACKED.get(wsebSession, false)) { // Expected for downstream reconnects return; } IoSessionEx transportSession = ((WsebSession)wsebSession).getTransportSession(); ALREADY_TRACKED.set(wsebSession, true); idleTracker.addSession(transportSession); WsCheckAliveFilter.addIfFeatureEnabled(transportSession.getFilterChain(), CHECK_ALIVE_FILTER, ((WsebSession) wsebSession).getLocalAddress().getOption(INACTIVITY_TIMEOUT), wsebSession, logger); }
WsCheckAliveFilter.addIfFeatureEnabled(filterChain, CHECK_ALIVE_FILTER, localAddress.getOption(INACTIVITY_TIMEOUT), logger);
@Override public void addBridgeFilters(IoFilterChain filterChain) { IoSession session = filterChain.getSession(); Encoding encoding = (Encoding) session.getAttribute(ENCODING_KEY); filterChain.addLast(CODEC_FILTER, codec); if (encoding != null) { switch (encoding) { case BASE64: // add framing before encoding filterChain.addLast(BASE64_FILTER, base64); break; case TEXT: // add framing before encoding filterChain.addLast(TEXT_FILTER, text); break; default: break; } } // We speak a new enough version of the WebSocket protocol that // we need to conform to the proper CLOSE semantics. filterChain.addLast(WsAcceptor.CLOSE_FILTER, new WsCloseFilter(WebSocketWireProtocol.RFC_6455, configuration, logger, scheduler)); // post-upgrade filter is added before WebSocket codec filter // where the type of this filter chain is still IoBuffer filterChain.addBefore(CODEC_FILTER, POST_UPGRADE_FILTER, postUpgrade); // (KG-7391) Use ping and pong to detect and close dead connections, if ws inactivity timeout is active final ResourceAddress connectAddress = (ResourceAddress) session.removeAttribute(WSN_CONNECT_ADDRESS_KEY); WsCheckAliveFilter.addIfFeatureEnabled(filterChain, WsnAcceptor.CHECK_ALIVE_FILTER, connectAddress.getOption(WsResourceAddress.INACTIVITY_TIMEOUT), logger); }