@@ -121,6 +121,7 @@ public String toString() {
121121 private String path ;
122122 private String timestampParam ;
123123 private List <String > transports ;
124+ private Map <String , Transport .Options > transportOptions ;
124125 private List <String > upgrades ;
125126 private Map <String , String > query ;
126127 /*package*/ LinkedList <Packet > writeBuffer = new LinkedList <Packet >();
@@ -202,6 +203,8 @@ public Socket(Options opts) {
202203 this .timestampRequests = opts .timestampRequests ;
203204 this .transports = new ArrayList <String >(Arrays .asList (opts .transports != null ?
204205 opts .transports : new String []{Polling .NAME , WebSocket .NAME }));
206+ this .transportOptions = opts .transportOptions != null ?
207+ opts .transportOptions : new HashMap <String , Transport .Options >();
205208 this .policyPort = opts .policyPort != 0 ? opts .policyPort : 843 ;
206209 this .rememberUpgrade = opts .rememberUpgrade ;
207210 this .callFactory = opts .callFactory != null ? opts .callFactory : defaultCallFactory ;
@@ -272,18 +275,22 @@ private Transport createTransport(String name) {
272275 query .put ("sid" , this .id );
273276 }
274277
278+ // per-transport options
279+ Transport .Options options = this .transportOptions .get (name );
280+
275281 Transport .Options opts = new Transport .Options ();
276- opts .hostname = this .hostname ;
277- opts .port = this .port ;
278- opts .secure = this .secure ;
279- opts .path = this .path ;
280282 opts .query = query ;
281- opts .timestampRequests = this .timestampRequests ;
282- opts .timestampParam = this .timestampParam ;
283- opts .policyPort = this .policyPort ;
284283 opts .socket = this ;
285- opts .callFactory = this .callFactory ;
286- opts .webSocketFactory = this .webSocketFactory ;
284+
285+ opts .hostname = options != null ? options .hostname : this .hostname ;
286+ opts .port = options != null ? options .port : this .port ;
287+ opts .secure = options != null ? options .secure : this .secure ;
288+ opts .path = options != null ? options .path : this .path ;
289+ opts .timestampRequests = options != null ? options .timestampRequests : this .timestampRequests ;
290+ opts .timestampParam = options != null ? options .timestampParam : this .timestampParam ;
291+ opts .policyPort = options != null ? options .policyPort : this .policyPort ;
292+ opts .callFactory = options != null ? options .callFactory : this .callFactory ;
293+ opts .webSocketFactory = options != null ? options .webSocketFactory : this .webSocketFactory ;
287294
288295 Transport transport ;
289296 if (WebSocket .NAME .equals (name )) {
@@ -866,7 +873,7 @@ public static class Options extends Transport.Options {
866873 public boolean rememberUpgrade ;
867874 public String host ;
868875 public String query ;
869-
876+ public Map < String , Transport . Options > transportOptions ;
870877
871878 private static Options fromURI (URI uri , Options opts ) {
872879 if (opts == null ) {
0 commit comments