@@ -70,6 +70,7 @@ function Socket (uri, opts) {
70
70
this . timestampParam = opts . timestampParam || 't' ;
71
71
this . timestampRequests = opts . timestampRequests ;
72
72
this . transports = opts . transports || [ 'polling' , 'websocket' ] ;
73
+ this . transportOptions = opts . transportOptions || { } ;
73
74
this . readyState = '' ;
74
75
this . writeBuffer = [ ] ;
75
76
this . prevBufferLen = 0 ;
@@ -163,35 +164,39 @@ Socket.prototype.createTransport = function (name) {
163
164
// transport name
164
165
query . transport = name ;
165
166
167
+ // per-transport options
168
+ var options = this . transportOptions [ name ] || { } ;
169
+
166
170
// session id if we already have one
167
171
if ( this . id ) query . sid = this . id ;
168
172
169
173
var transport = new transports [ name ] ( {
170
- agent : this . agent ,
171
- hostname : this . hostname ,
172
- port : this . port ,
173
- secure : this . secure ,
174
- path : this . path ,
175
174
query : query ,
176
- forceJSONP : this . forceJSONP ,
177
- jsonp : this . jsonp ,
178
- forceBase64 : this . forceBase64 ,
179
- enablesXDR : this . enablesXDR ,
180
- timestampRequests : this . timestampRequests ,
181
- timestampParam : this . timestampParam ,
182
- policyPort : this . policyPort ,
183
175
socket : this ,
184
- pfx : this . pfx ,
185
- key : this . key ,
186
- passphrase : this . passphrase ,
187
- cert : this . cert ,
188
- ca : this . ca ,
189
- ciphers : this . ciphers ,
190
- rejectUnauthorized : this . rejectUnauthorized ,
191
- perMessageDeflate : this . perMessageDeflate ,
192
- extraHeaders : this . extraHeaders ,
193
- forceNode : this . forceNode ,
194
- localAddress : this . localAddress
176
+ agent : options . agent || this . agent ,
177
+ hostname : options . hostname || this . hostname ,
178
+ port : options . port || this . port ,
179
+ secure : options . secure || this . secure ,
180
+ path : options . path || this . path ,
181
+ forceJSONP : options . forceJSONP || this . forceJSONP ,
182
+ jsonp : options . jsonp || this . jsonp ,
183
+ forceBase64 : options . forceBase64 || this . forceBase64 ,
184
+ enablesXDR : options . enablesXDR || this . enablesXDR ,
185
+ timestampRequests : options . timestampRequests || this . timestampRequests ,
186
+ timestampParam : options . timestampParam || this . timestampParam ,
187
+ policyPort : options . policyPort || this . policyPort ,
188
+ pfx : options . pfx || this . pfx ,
189
+ key : options . key || this . key ,
190
+ passphrase : options . passphrase || this . passphrase ,
191
+ cert : options . cert || this . cert ,
192
+ ca : options . ca || this . ca ,
193
+ ciphers : options . ciphers || this . ciphers ,
194
+ rejectUnauthorized : options . rejectUnauthorized || this . rejectUnauthorized ,
195
+ perMessageDeflate : options . perMessageDeflate || this . perMessageDeflate ,
196
+ extraHeaders : options . extraHeaders || this . extraHeaders ,
197
+ forceNode : options . forceNode || this . forceNode ,
198
+ localAddress : options . localAddress || this . localAddress ,
199
+ requestTimeout : options . requestTimeout || this . requestTimeout
195
200
} ) ;
196
201
197
202
return transport ;
0 commit comments