glisten

Types

Reasons that serve might fail

pub type StartError {
  ListenerClosed
  ListenerTimeout
  AcceptorTimeout
  AcceptorFailed(process.ExitReason)
  AcceptorCrashed(Dynamic)
  SystemError(SocketReason)
}

Constructors

  • ListenerClosed
  • ListenerTimeout
  • AcceptorTimeout
  • AcceptorFailed(process.ExitReason)
  • AcceptorCrashed(Dynamic)
  • SystemError(SocketReason)

Functions

pub fn serve(port: Int, with_pool: fn(ListenSocket) -> Pool(a)) -> Result(
  Nil,
  StartError,
)

Sets up a TCP listener with the given acceptor pool. The second argument can be obtained from the glisten/acceptor.{acceptor_pool} function.

pub fn serve_ssl(port port: Int, certfile certfile: String, keyfile keyfile: String, with_pool with_pool: fn(
    ListenSocket,
  ) -> Pool(a)) -> Result(Nil, StartError)

Sets up a SSL listener with the given acceptor pool. The second argument can be obtained from the glisten/acceptor.{acceptor_pool} function.

Search Document