Documentation

Std.Http.Server.Connection

Connection #

This module defines Server.Connection, a structure used to handle a single HTTP connection with possibly multiple requests.

Represents the remote address of a client connection.

Instances For

    A single HTTP connection.

    Instances For
      def Std.Http.Server.serveConnection {t σ : Type} [Transport t] [Handler σ] (client : t) (handler : σ) (config : Config) (extensions : Extensions := Extensions.empty) :

      Handles request/response processing for a single connection using an Async handler. The library-level entry point for running a server is Server.serve. This function can be used with a TCP.Socket or any other type that implements Transport to build custom server loops.

      Example #

      -- Create a TCP socket server instance
      let server ← Socket.Server.mk
      server.bind addr
      server.listen backlog
      
      -- Enter an infinite loop to handle incoming client connections
      while true do
        let client ← server.accept
        background (serveConnection client handler config)
      
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For