@@ -121,6 +121,7 @@ public String toString() {
121
121
private String path ;
122
122
private String timestampParam ;
123
123
private List <String > transports ;
124
+ private Map <String , Transport .Options > transportOptions ;
124
125
private List <String > upgrades ;
125
126
private Map <String , String > query ;
126
127
/*package*/ LinkedList <Packet > writeBuffer = new LinkedList <Packet >();
@@ -202,6 +203,8 @@ public Socket(Options opts) {
202
203
this .timestampRequests = opts .timestampRequests ;
203
204
this .transports = new ArrayList <String >(Arrays .asList (opts .transports != null ?
204
205
opts .transports : new String []{Polling .NAME , WebSocket .NAME }));
206
+ this .transportOptions = opts .transportOptions != null ?
207
+ opts .transportOptions : new HashMap <String , Transport .Options >();
205
208
this .policyPort = opts .policyPort != 0 ? opts .policyPort : 843 ;
206
209
this .rememberUpgrade = opts .rememberUpgrade ;
207
210
this .callFactory = opts .callFactory != null ? opts .callFactory : defaultCallFactory ;
@@ -272,18 +275,22 @@ private Transport createTransport(String name) {
272
275
query .put ("sid" , this .id );
273
276
}
274
277
278
+ // per-transport options
279
+ Transport .Options options = this .transportOptions .get (name );
280
+
275
281
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 ;
280
282
opts .query = query ;
281
- opts .timestampRequests = this .timestampRequests ;
282
- opts .timestampParam = this .timestampParam ;
283
- opts .policyPort = this .policyPort ;
284
283
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 ;
287
294
288
295
Transport transport ;
289
296
if (WebSocket .NAME .equals (name )) {
@@ -866,7 +873,7 @@ public static class Options extends Transport.Options {
866
873
public boolean rememberUpgrade ;
867
874
public String host ;
868
875
public String query ;
869
-
876
+ public Map < String , Transport . Options > transportOptions ;
870
877
871
878
private static Options fromURI (URI uri , Options opts ) {
872
879
if (opts == null ) {
0 commit comments