glisten

Types

Reasons that serve might fail

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

Constructors

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

Functions

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

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