switch (clientTransportType)
{
case LONG_POLLING:
{
Map<String, Object> options = new HashMap<>();
options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
options.put(ClientTransport.MAX_NETWORK_DELAY_OPTION, Config.MAX_NETWORK_DELAY);
return new LongPollingTransport(options, httpClient);
}
case JSR_WEBSOCKET:
{
Map<String, Object> options = new HashMap<>();
options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
options.put(ClientTransport.MAX_NETWORK_DELAY_OPTION, Config.MAX_NETWORK_DELAY);
// Differently from HTTP where the idle timeout is adjusted if it is a /meta/connect
// for WebSocket we need an idle timeout that is longer than the /meta/connect timeout.
options.put(WebSocketTransport.IDLE_TIMEOUT_OPTION, Config.META_CONNECT_TIMEOUT + httpClient.getIdleTimeout());
return new WebSocketTransport(options, scheduler, webSocketContainer);
}
case JETTY_WEBSOCKET:
{
Map<String, Object> options = new HashMap<>();
options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
options.put(ClientTransport.MAX_NETWORK_DELAY_OPTION, Config.MAX_NETWORK_DELAY);
// Differently from HTTP where the idle timeout is adjusted if it is a /meta/connect
// for WebSocket we need an idle timeout that is longer than the /meta/connect timeout.
options.put(JettyWebSocketTransport.IDLE_TIMEOUT_OPTION, Config.META_CONNECT_TIMEOUT + httpClient.getIdleTimeout());
return new JettyWebSocketTransport(options, scheduler, webSocketClient);