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 completionHandlerfunction 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 handlerfunction - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- NetServer
-
connectStream() → {NetSocketStream}
-
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
- NetSocketStream
-
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 portnumber the port to listen on hoststring the host to listen on listenHandlerfunction handler that will be notified when listening or failed - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- NetServer