An HTTP and WebSockets server.
You receive HTTP requests by providing a requestHandler. As requests arrive on the server the handler will be called with the requests.
You receive WebSockets by providing a websocketHandler. As WebSocket connections arrive on the server, the WebSocket is passed to the handler.
Anything
HttpServer
Basic
Identifiable
Object
Anything
no subtypes hierarchy
Initializer |
HttpServer(HttpServer unknown) |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Methods | |
close | shared default void close() Close the server. Any open HTTP connections will be closed. The close happens asynchronously and the server may not be closed until some time after the call has returned. |
close | shared default void close(Anything(Throwable?) completionHandler) Like close but supplying a handler that will be called when the server is actually closed (or has failed). Parameters:
|
isMetricsEnabled | shared actual default Boolean isMetricsEnabled() Whether the metrics are enabled for this measured object Refines Measured.isMetricsEnabled |
listen | shared default HttpServer listen() Tell the server to start listening. The server will listen on the port and host specified in the HttpServerOptions that was used when creating the server. The listen happens asynchronously and the server may not be listening until some time after the call has returned. |
listen | shared default HttpServer listen(Anything(Throwable|HttpServer) listenHandler) Like listen but supplying a handler that will be called when the server is actually listening (or has failed). Parameters:
|
listen | shared default HttpServer listen(Integer port) Like listen but the server will listen on host “0.0.0.0” and port specified here ignoring any value in the HttpServerOptions that was used when creating the server. Parameters:
|
listen | shared default HttpServer listen(Integer port, Anything(Throwable|HttpServer) listenHandler) Like listen but supplying a handler that will be called when the server is actually listening (or has failed). Parameters:
|
listen | shared default HttpServer listen(Integer port, String host) Tell the server to start listening. The server will listen on the port and host specified here, ignoring any value set in the HttpServerOptions that was used when creating the server. The listen happens asynchronously and the server may not be listening until some time after the call has returned. Parameters:
|
listen | shared default HttpServer listen(Integer port, String host, Anything(Throwable|HttpServer) listenHandler) Like listen but supplying a handler that will be called when the server is actually listening (or has failed). Parameters:
|
requestHandler | shared default HttpServer requestHandler(Anything(HttpServerRequest) handler) Set the request handler for the server to |
requestStream | shared default HttpServerRequestStream requestStream() Return the request stream for the server. As HTTP requests are received by the server, instances of HttpServerRequest will be created and passed to the stream . |
websocketHandler | shared default HttpServer websocketHandler(Anything(ServerWebSocket) handler) Set the websocket handler for the server to |
websocketStream | shared default ServerWebSocketStream websocketStream() Return the websocket stream for the server. If a websocket connect handshake is successful a new ServerWebSocket instance will be created and passed to the stream . |
Inherited Methods |
Methods inherited from: Object equals |
Methods inherited from: Measured |