class Server extends Object with StObject
- Annotations
- @JSType() @JSImport("http", "Server") @native()
- Since
v0.1.17
- Alphabetic
- By Inheritance
- Server
- StObject
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Server(options: ServerOptions, requestListener: RequestListener)
- new Server(requestListener: RequestListener)
- new Server(options: ServerOptions)
- new Server()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addListener(event: String, listener: Function1[Any, Unit]): Server.this.type
- def addListener_checkContinue(event: checkContinue, listener: RequestListener): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_checkExpectation(event: checkExpectation, listener: RequestListener): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_clientError(event: clientError, listener: Function2[Error, Duplex, Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_close(event: close, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_connect(event: connect, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_connection(event: connection, listener: Function1[Socket, Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_error(event: error, listener: Function1[Error, Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_listening(event: listening, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_request(event: request, listener: RequestListener): Server.this.type
- Annotations
- @JSName("addListener")
- def addListener_upgrade(event: upgrade, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("addListener")
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def emit(event: String, args: Any*): Boolean
- def emit_checkContinue(event: checkContinue, req: IncomingMessage, res: ServerResponse): Boolean
- Annotations
- @JSName("emit")
- def emit_checkExpectation(event: checkExpectation, req: IncomingMessage, res: ServerResponse): Boolean
- Annotations
- @JSName("emit")
- def emit_clientError(event: clientError, err: Error, socket: Duplex): Boolean
- Annotations
- @JSName("emit")
- def emit_close(event: close): Boolean
- Annotations
- @JSName("emit")
- def emit_connect(event: connect, req: IncomingMessage, socket: Duplex, head: Buffer): Boolean
- Annotations
- @JSName("emit")
- def emit_connection(event: connection, socket: Socket): Boolean
- Annotations
- @JSName("emit")
- def emit_error(event: error, err: Error): Boolean
- Annotations
- @JSName("emit")
- def emit_listening(event: listening): Boolean
- Annotations
- @JSName("emit")
- def emit_request(event: request, req: IncomingMessage, res: ServerResponse): Boolean
- Annotations
- @JSName("emit")
- def emit_upgrade(event: upgrade, req: IncomingMessage, socket: Duplex, head: Buffer): Boolean
- Annotations
- @JSName("emit")
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- var headersTimeout: Double
Limit the amount of time the parser will wait to receive the complete HTTP headers.
Limit the amount of time the parser will wait to receive the complete HTTP headers.
In case of inactivity, the rules defined in
server.timeout
apply. However, that inactivity based timeout would still allow the connection to be kept open if the headers are being sent very slowly (by default, up to a byte per 2 minutes). In order to prevent this, whenever header data arrives an additional check is made that more thanserver.headersTimeout
milliseconds has not passed since the connection was established. If the check fails, a'timeout'
event is emitted on the server object, and (by default) the socket is destroyed. Seeserver.timeout
for more information on how timeout behavior can be customized.- Since
v11.3.0, v10.14.0
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- var keepAliveTimeout: Double
The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed.
The number of milliseconds of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed. If the server receives new data before the keep-alive timeout has fired, it will reset the regular inactivity timeout, i.e.,
server.timeout
.A value of
0
will disable the keep-alive timeout behavior on incoming connections. A value of0
makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections.
- Since
v8.0.0
- var maxHeadersCount: |[Double, Null]
Limits maximum incoming headers count.
Limits maximum incoming headers count. If set to 0, no limit will be applied.
- Since
v0.7.0
- var maxRequestsPerSocket: |[Double, Null]
The maximum number of requests socket can handle before closing keep alive connection.
The maximum number of requests socket can handle before closing keep alive connection.
A value of
0
will disable the limit.When the limit is reached it will set the
Connection
header value toclose
, but will not actually close the connection, subsequent requests sent after the limit is reached will get503 Service Unavailable
as a response.- Since
v16.10.0
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def on(event: String, listener: Function1[Any, Unit]): Server.this.type
- def on_checkContinue(event: checkContinue, listener: RequestListener): Server.this.type
- Annotations
- @JSName("on")
- def on_checkExpectation(event: checkExpectation, listener: RequestListener): Server.this.type
- Annotations
- @JSName("on")
- def on_clientError(event: clientError, listener: Function2[Error, Duplex, Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_close(event: close, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_connect(event: connect, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_connection(event: connection, listener: Function1[Socket, Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_error(event: error, listener: Function1[Error, Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_listening(event: listening, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("on")
- def on_request(event: request, listener: RequestListener): Server.this.type
- Annotations
- @JSName("on")
- def on_upgrade(event: upgrade, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("on")
- def once(event: String, listener: Function1[Any, Unit]): Server.this.type
- def once_checkContinue(event: checkContinue, listener: RequestListener): Server.this.type
- Annotations
- @JSName("once")
- def once_checkExpectation(event: checkExpectation, listener: RequestListener): Server.this.type
- Annotations
- @JSName("once")
- def once_clientError(event: clientError, listener: Function2[Error, Duplex, Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_close(event: close, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_connect(event: connect, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_connection(event: connection, listener: Function1[Socket, Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_error(event: error, listener: Function1[Error, Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_listening(event: listening, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("once")
- def once_request(event: request, listener: RequestListener): Server.this.type
- Annotations
- @JSName("once")
- def once_upgrade(event: upgrade, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("once")
- def prependListener(event: String, listener: Function1[Any, Unit]): Server.this.type
- def prependListener_checkContinue(event: checkContinue, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_checkExpectation(event: checkExpectation, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_clientError(event: clientError, listener: Function2[Error, Duplex, Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_close(event: close, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_connect(event: connect, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_connection(event: connection, listener: Function1[Socket, Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_error(event: error, listener: Function1[Error, Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_listening(event: listening, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_request(event: request, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_upgrade(event: upgrade, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("prependListener")
- def prependOnceListener(event: String, listener: Function1[Any, Unit]): Server.this.type
- def prependOnceListener_checkContinue(event: checkContinue, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_checkExpectation(event: checkExpectation, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_clientError(event: clientError, listener: Function2[Error, Duplex, Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_close(event: close, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_connect(event: connect, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_connection(event: connection, listener: Function1[Socket, Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_error(event: error, listener: Function1[Error, Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_listening(event: listening, listener: Function0[Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_request(event: request, listener: RequestListener): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_upgrade(event: upgrade, listener: Function3[IncomingMessage, Duplex, Buffer, Unit]): Server.this.type
- Annotations
- @JSName("prependOnceListener")
- def propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- var requestTimeout: Double
Sets the timeout value in milliseconds for receiving the entire request from the client.
Sets the timeout value in milliseconds for receiving the entire request from the client.
If the timeout expires, the server responds with status 408 without forwarding the request to the request listener and then closes the connection.
It must be set to a non-zero value (e.g. 120 seconds) to protect against potential Denial-of-Service attacks in case the server is deployed without a reverse proxy in front.
- Since
v14.11.0
- def setTimeout(msecs: Unit, callback: Function0[Unit]): Server.this.type
- def setTimeout(msecs: Double, callback: Function0[Unit]): Server.this.type
- def setTimeout(msecs: Double): Server.this.type
- def setTimeout(callback: Function0[Unit]): Server.this.type
- def setTimeout(): Server.this.type
Sets the timeout value for sockets, and emits a
'timeout'
event on the Server object, passing the socket as an argument, if a timeout occurs.Sets the timeout value for sockets, and emits a
'timeout'
event on the Server object, passing the socket as an argument, if a timeout occurs.If there is a
'timeout'
event listener on the Server object, then it will be called with the timed-out socket as an argument.By default, the Server does not timeout sockets. However, if a callback is assigned to the Server's
'timeout'
event, timeouts must be handled explicitly.- Since
v0.9.12
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- var timeout: Double
The number of milliseconds of inactivity before a socket is presumed to have timed out.
The number of milliseconds of inactivity before a socket is presumed to have timed out.
A value of
0
will disable the timeout behavior on incoming connections.The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections.
- Since
v0.9.12
- def toLocaleString(): String
- Definition Classes
- Object
- def toString(): String
- Definition Classes
- AnyRef → Any
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated