1 parent da698ae commit c0189deCopy full SHA for c0189de
1 file changed
src/index.js
@@ -137,9 +137,15 @@ const headers = ripple => next => res => {
137
}
138
139
const io = opts => {
140
+ const transports = client
141
+ && document.currentScript
142
+ && document.currentScript.getAttribute('transports')
143
+ && document.currentScript.getAttribute('transports').split(',')
144
+ || undefined
145
+
146
const r = !client ? require('socket.io')(opts.server || opts)
- : window.io ? window.io({ transports: ['websocket', 'polling'] })
- : is.fn(require('socket.io-client')) ? require('socket.io-client')({ transports: ['websocket', 'polling'] })
147
+ : window.io ? window.io({ transports })
148
+ : is.fn(require('socket.io-client')) ? require('socket.io-client')({ transports })
149
: { on: noop, emit: noop }
150
r.use = r.use || noop
151
return r
0 commit comments