listen

open fun listen(endpoint: Endpoint): Int

Start serving the provided endpoint on the port specified by the environment variable PORT, or alternatively on the default 9080 port.

NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually create the server with fromEndpoint and start listening it.

Return

The listening port


open fun listen(endpointBuilder: Endpoint.Builder): Int
open fun listen(endpointBuilder: Endpoint.Builder, port: Int): Int

Like listen


open fun listen(endpoint: Endpoint, port: Int): Int

Start serving the provided endpoint on the specified port.

NOTE: this method will block for opening the socket and reserving the port. If you need a non-blocking variant, manually create the server with fromEndpoint and start listening it.

Return

The listening port