An HTTP and WebSockets server.
You receive HTTP requests by providing a @see \io\vertx\jphp\core\http\HttpServer::requestHandler. As requests arrive on the server the handler will be called with the requests.
You receive WebSockets by providing a @see \io\vertx\jphp\core\http\HttpServer::websocketHandler. As WebSocket connections arrive on the server, the WebSocket is passed to the handler.
package |
Default |
---|
__construct()
actualPort() : integer
integer
the actual port the server is listening on.
close( $arg0) : void
callable
connectionHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
exceptionHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
isMetricsEnabled() : boolean
boolean
{@code true} if metrics are enabled
listen( $arg0, $arg1 = null, $arg2 = null) : $this
param $listenHandler [callable] the listen handler listen($listenHandler)
Tell the server to start listening on the given address supplying a handler that will be called when the server is actually listening (or has failed).
param $address [SocketAddress] the address to listen on param $listenHandler [callable] the listen handler listen($address, $listenHandler)
Like @see \io\vertx\jphp\core\http\HttpServer::listen but supplying a handler that will be called when the server is actually listening (or has failed).
param $port [integer] the port to listen on param $listenHandler [callable] the listen handler listen($port, $listenHandler)
Like @see \io\vertx\jphp\core\http\HttpServer::listen but supplying a handler that will be called when the server is actually listening (or has failed).
param $port [integer] the port to listen on param $host [string] the host to listen on param $listenHandler [callable] the listen handler listen($port, $host, $listenHandler)
callable | integer | SocketAddress
callable | string
callable
$this
requestHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
requestStream() : \io\vertx\jphp\core\http\ReadStream<HttpServerRequest>
\io\vertx\jphp\core\http\ReadStream
the request stream
websocketHandler( $arg0) : $this
callable
$this
a reference to this, so the API can be used fluently
websocketStream() : \io\vertx\jphp\core\http\ReadStream<ServerWebSocket>
\io\vertx\jphp\core\http\ReadStream
the websocket stream