Skip to content

HTTPHandler

[Source]

This is the interface through which HTTP messages are delivered to application code. On the server, this will be HTTP Requests (GET, HEAD, DELETE, POST, etc) sent from a client. On the client, this will be the HTTP Responses coming back from the server. The protocol is largely symmetrical and the same interface definition is used, though what processing happens behind the interface will of course vary.

This interface delivers asynchronous events when receiving an HTTP message (called a Payload). Calls to these methods are made in the context of the HTTPSession actor so most of them should be passing data on to a processing actor.

Each HTTPSession must have a unique instance of the handler. The application code does not necessarily know when an HTTPSession is created, so the application must provide an instance of HandlerFactory that will be called at the appropriate time.

interface ref HTTPHandler

Public Functions

apply

[Source]

fun ref apply(
  payload: Payload val)
: Any tag

Parameters

Returns


chunk

[Source]

Notification of incoming body data. The body belongs to the most recent Payload delivered by an apply notification.

fun ref chunk(
  data: (String val | Array[U8 val] val))
: None val

Parameters

Returns


finished

[Source]

Notification that no more body chunks are coming. Delivery of this HTTP message is complete.

fun ref finished()
: None val

Returns


cancelled

[Source]

Notification that transferring the payload has been cancelled locally, e.g. by disposing the client, closing the server or manually cancelling a single request.

fun ref cancelled()
: None val

Returns


failed

[Source]

Notification about failure to transfer the payload (e.g. connection could not be established, authentication failed, connection was closed prematurely, ...)

fun ref failed(
  reason: (AuthFailed val | ConnectionClosed val | ConnectFailed val))
: None val

Parameters

Returns


throttled

[Source]

Notification that the session temporarily can not accept more data.

fun ref throttled()
: None val

Returns


unthrottled

[Source]

Notification that the session can resume accepting data.

fun ref unthrottled()
: None val

Returns


need_body

[Source]

Notification that the HTTPSession is ready for Stream or Chunked body data.

fun ref need_body()
: None val

Returns