Class: NetServer

vertx-js/net_server~ NetServer

new NetServer()

Represents a TCP server
Source:

Methods

actualPort() → {number}

The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port
Source:
Returns:
the actual port the server is listening on.
Type
number

close(completionHandler)

Like NetServer#close but supplying a handler that will be notified when close is complete.
Parameters:
Name Type Description
completionHandler function the handler
Source:

connectHandler(handler) → {NetServer}

Supply a connect handler for this server. The server can only have at most one connect handler at any one time. As the server accepts TCP or SSL connections it creates an instance of NetSocket and passes it to the connect handler.
Parameters:
Name Type Description
handler function
Source:
Returns:
a reference to this, so the API can be used fluently
Type
NetServer

connectStream() → {ReadStream}

Return the connect stream for this server. The server can only have at most one handler at any one time. As the server accepts TCP or SSL connections it creates an instance of NetSocket and passes it to the connect stream .
Source:
Returns:
the connect stream
Type
ReadStream

isMetricsEnabled() → {boolean}

Whether the metrics are enabled for this measured object
Source:
Returns:
true if the metrics are enabled
Type
boolean

listen(port, host, listenHandler) → {NetServer}

Like NetServer#listen but providing a handler that will be notified when the server is listening, or fails.
Parameters:
Name Type Description
port number the port to listen on
host string the host to listen on
listenHandler function handler that will be notified when listening or failed
Source:
Returns:
a reference to this, so the API can be used fluently
Type
NetServer