src/server/Server.js
// contains the configured options. Used for setting defaults, and such.
contains the configured options. Used for setting defaults, and such.
contains the configured options . Used for setting defaults and such .
function resolveOptions (options) {
  const heartbeatTimeout = Number(options.heartbeatTimeout || 15000)
  if (Number.isNaN(heartbeatTimeout)) {
    throw new Error('Invalid parameter for heartbeatTimeout: Must be a number')
  }
  const heartbeatInterval = Number(options.heartbeatInterval || 10000)
  if (Number.isNaN(heartbeatInterval)) {
    throw new Error('Invalid parameter for heartbeatInterval: Must be a number')
  }
  const handshakeTimeout = Number(options.handshakeTimeout || 10000)
  if (Number.isNaN(handshakeTimeout)) {
    throw new Error('Invalid parameter for handshakeTimeout: Must be a number')
  }
  const supportsResuming = Boolean(options.supportsResuming)
  const resumeAllowsDifferentIPs = Boolean(options.resumeAllowsDifferentIPs)
  const maxSessionAge = Number(options.maxSessionAge || 10000)
  if (Number.isNaN(maxSessionAge)) {
    throw new Error('Invalid parameter for maxSessionAge: Must be a number')
  }
  return {
    heartbeatTimeout,
    heartbeatInterval,
    handshakeTimeout,
    supportsResuming,
    resumeAllowsDifferentIPs,
    maxSessionAge
  }
}
function resolveOptions ( options ) { const heartbeatTimeout = Number ( options . heartbeatTimeout || 15000 ) if ( Number . isNaN ( heartbeatTimeout ) ) { throw new Error ( 'Invalid parameter for heartbeatTimeout: Must be a number' ) } const heartbeatInterval = Number ( options . heartbeatInterval || 10000 ) if ( Number . isNaN ( heartbeatInterval ) ) { throw new Error ( 'Invalid parameter for heartbeatInterval: Must be a number' ) } const handshakeTimeout = Number ( options . handshakeTimeout || 10000 ) if ( Number . isNaN ( handshakeTimeout ) ) { throw new Error ( 'Invalid parameter for handshakeTimeout: Must be a number' ) } const supportsResuming = Boolean ( options . supportsResuming ) const resumeAllowsDifferentIPs = Boolean ( options . resumeAllowsDifferentIPs ) const maxSessionAge = Number ( options . maxSessionAge || 10000 ) if ( Number . isNaN ( maxSessionAge ) ) { throw new Error ( 'Invalid parameter for maxSessionAge: Must be a number' ) } return { heartbeatTimeout , heartbeatInterval , handshakeTimeout , supportsResuming , resumeAllowsDifferentIPs , maxSessionAge } }
contains the configured options.
contains the configured options .
// How long to wait for client's pong response before quitting. // How long to wait since last ping to send another ping message. // How long to wait before considering the handshake as timed out. // Whether to allow session resuming for the server. // If we support session resuming, whether to allow session resuming to be done // from a client with a different IP. // How long to wait for someone to resume the session before we delete it.