new HttpServer()
An HTTP and websockets server. Created by calling
module:vertx/http.createHttpServer
.
- Source:
Example
var http = require('vertx/http');
var server = http.createHttpServer();
server.requestHandler( function(request) {
// handle the incoming request
}
server.listen(8000, 'localhost');
Extends
- module:vertx/tcp_support~TCPSupport
- module:vertx/tcp_support~ServerTCPSupport
- module:vertx/ssl_support~SSLSupport
- module:vertx/ssl_support~ServerSSLSupport
Methods
-
acceptBacklog(backlog) → {number|Object}
-
Set or get the server's accept backlog
Parameters:
Name Type Argument Description backlog
number <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- number | Object
-
clientAuthRequired(required) → {boolean|Object}
-
Get or set whether client authorization is required
Parameters:
Name Type Argument Description required
boolean <optional>
If provided, sets whether client authorization is required - Inherited From:
- Source:
Returns:
the current status, orthis
- Type
- boolean | Object
-
close(handler)
-
Close the server. If a handler is supplied, it will be called when the underlying connection has completed closing.
Parameters:
Name Type Argument Description handler
Handler <optional>
The handler to notify when close() completes - Source:
-
compressionSupported(supported) → {boolean|module:vertx/http.HttpServer}
-
Set or get whether the server should compress the http response if the connected client supports it.
Parameters:
Name Type Argument Description supported
boolean <optional>
whether compression should be supported when possible - Source:
Returns:
the current server configuration or self- Type
- boolean | module:vertx/http.HttpServer
-
keyStorePassword(password) → {boolean|Object}
-
Get or set the current keystore password for this object.
Parameters:
Name Type Argument Description password
string <optional>
If provided, sets the keystore password - Inherited From:
- Source:
Returns:
the current password, orthis
.- Type
- boolean | Object
-
keyStorePath(path) → {boolean|Object}
-
Get or set the current keystore path for this object.
Parameters:
Name Type Argument Description path
string <optional>
If provided, sets the keystore path - Inherited From:
- Source:
Returns:
the current path, orthis
.- Type
- boolean | Object
-
listen(port, host, listenHandler) → {module:vertx/http.HttpServer}
-
Start to listen for incoming HTTP requests
Parameters:
Name Type Argument Description port
number The port to listen on host
string <optional>
The host name or IP address listenHandler
Handler <optional>
A handler to be notified when the underlying system level listen() call has completed. - Source:
Returns:
-
maxWebSocketFrameSize(size)
-
Set or get the maximum frame size for websocket connections exposed over the SockJS bridge with this HTTPServer
Parameters:
Name Type Argument Description size
number <optional>
The frame size in bytes - Source:
-
receiveBufferSize(size) → {number|Object}
-
Set or get the receive buffer size
Parameters:
Name Type Argument Description size
number <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- number | Object
-
requestHandler(handler) → {module:vertx/http.HttpServer}
-
Set the request handler for the server. As HTTP requests are received by the server, instances of
HttpServerRequest
will be created and passed to this handler.Parameters:
Name Type Description handler
RequestHandler the function used to handle the request. - Source:
Returns:
-
reuseAddress(reuse) → {boolean|Object}
-
Set or get the TCP reuse address value
Parameters:
Name Type Argument Description reuse
boolean <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- boolean | Object
-
sendBufferSize(size) → {number|Object}
-
Set or get the send buffer size
Parameters:
Name Type Argument Description size
number <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- number | Object
-
soLinger(linger) → {boolean|Object}
-
Set or get the TCP so linger value
Parameters:
Name Type Argument Description linger
boolean <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- boolean | Object
-
ssl(ssl) → {boolean|Object}
-
Get or set the current SSL support for this object.
Parameters:
Name Type Argument Description ssl
boolean <optional>
If provided, sets whether this object supports SSL - Inherited From:
- Source:
Returns:
the current status, orthis
.- Type
- boolean | Object
-
tcpKeepAlive(keepAlive) → {boolean|Object}
-
Set or get the TCP keep-alive value
Parameters:
Name Type Argument Description keepAlive
boolean <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- boolean | Object
-
tcpNoDelay(nodelay) → {boolean|Object}
-
Set or get the TCP no delay value.
Parameters:
Name Type Argument Description nodelay
boolean <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- boolean | Object
-
trafficClass(class) → {number|Object}
-
Set or get the TCP traffic class
Parameters:
Name Type Argument Description class
number <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- number | Object
-
trustStorePassword(password) → {boolean|Object}
-
Get or set the current trust store password for this object.
Parameters:
Name Type Argument Description password
string <optional>
If provided, sets the trust store password - Inherited From:
- Source:
Returns:
the current password, orthis
.- Type
- boolean | Object
-
trustStorePath(path) → {boolean|Object}
-
Get or set the current trust store path for this object.
Parameters:
Name Type Argument Description path
string <optional>
If provided, sets the trust store path - Inherited From:
- Source:
Returns:
the current path, orthis
.- Type
- boolean | Object
-
usePooledBuffers(use) → {boolean|Object}
-
Set or get if vertx should use pooled buffers for performance reasons. Doing so will give the best throughput but may need a bit higher memory footprint.
Parameters:
Name Type Argument Description use
boolean <optional>
If provided, set the value; if not, returns the current value. - Inherited From:
- Source:
Returns:
the value or this- Type
- boolean | Object
-
websocketHandler(handler) → {module:vertx/http.HttpServer}
-
Set the websocket handler for the server. If a websocket connect handshake is successful a new
WebSocket
instance will be created and passed to the handler.Parameters:
Name Type Description handler
WebSocketHandler the function used to handle the request. - Source:
Returns: