Skip to content

Commit

Permalink
Limits options passed
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenwhite24 committed Mar 24, 2020
1 parent 2b13a41 commit fededfb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ const debounce = require('./debounce')
const throttle = require('./throttle')
const toError = require('./toError')

const ALLOWED_OPTIONS = [
'randomizationFactor',
'reconnection',
'reconnectionAttempts',
'reconnectionDelay',
'reconnectionDelayMax',
'timeout',
'transports',
'upgrade'
]

const key = curry((type, payload) =>
`${type}/${payload.id}`
)
Expand All @@ -36,7 +47,8 @@ const sox = (args = {}) => {
query: merge(session, query())
}

const socket = io(base, merge(options, opts))
const getOptions = compose(merge(opts), pick(ALLOWED_OPTIONS))
const socket = io(base, getOptions(options))

const connect = bind(socket.connect, socket)

Expand Down

0 comments on commit fededfb

Please sign in to comment.