(
srv: undefined | Partial<ServerOptions> | TServerInstance | number,
opts: Partial<ServerOptions> = {},
)
| 299 | opts?: Partial<ServerOptions>, |
| 300 | ); |
| 301 | constructor( |
| 302 | srv: undefined | Partial<ServerOptions> | TServerInstance | number, |
| 303 | opts: Partial<ServerOptions> = {}, |
| 304 | ) { |
| 305 | super(); |
| 306 | if ( |
| 307 | class="st">"object" === typeof srv && |
| 308 | srv instanceof Object && |
| 309 | !(srv as Partial<HTTPServer>).listen |
| 310 | ) { |
| 311 | opts = srv as Partial<ServerOptions>; |
| 312 | srv = undefined; |
| 313 | } |
| 314 | this.path(opts.path || class="st">"/socket.io"); |
| 315 | this.connectTimeout(opts.connectTimeout || 45000); |
| 316 | this.serveClient(false !== opts.serveClient); |
| 317 | this._parser = opts.parser || parser; |
| 318 | this.encoder = new this._parser.Encoder(); |
| 319 | this.opts = opts; |
| 320 | if (opts.connectionStateRecovery) { |
| 321 | opts.connectionStateRecovery = Object.assign( |
| 322 | { |
| 323 | maxDisconnectionDuration: 2 * 60 * 1000, |
| 324 | skipMiddlewares: true, |
| 325 | }, |
| 326 | opts.connectionStateRecovery, |
| 327 | ); |
| 328 | this.adapter(opts.adapter || SessionAwareAdapter); |
| 329 | } else { |
| 330 | this.adapter(opts.adapter || Adapter); |
| 331 | } |
| 332 | opts.cleanupEmptyChildNamespaces = !!opts.cleanupEmptyChildNamespaces; |
| 333 | this.sockets = this.of(class="st">"/"); |
| 334 | if (srv || typeof srv == class="st">"number") |
| 335 | this.attach(srv as TServerInstance | number); |
| 336 | |
| 337 | if (this.opts.cors) { |
| 338 | this._corsMiddleware = corsMiddleware(this.opts.cors); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | get _opts() { |
| 343 | return this.opts; |
nothing calls this directly
no test coverage detected