HTTPClientConnectionActor¶
Trait for actors that make HTTP client connections.
Extends TCPConnectionActor (for lori ASIO plumbing) and
HTTPClientLifecycleEventReceiver (for HTTP-level callbacks). The
actor stores an HTTPClientConnection as a field and implements
_http_client_connection() to return it. All other required methods have
default implementations that delegate to the protocol.
Minimal implementation:
actor MyClient is HTTPClientConnectionActor
var _http: HTTPClientConnection = HTTPClientConnection.none()
new create(auth: lori.TCPConnectAuth, host: String, port: String,
config: ClientConnectionConfig)
=>
_http = HTTPClientConnection(auth, host, port, this, config)
fun ref _http_client_connection(): HTTPClientConnection => _http
fun ref on_connected() =>
let request = HTTPRequest(GET, "/")
_http.send_request(request)
fun ref on_response(version: Version, status: U16,
reason: String val, headers: Headers val)
=>
// process response
None
For HTTPS, use HTTPClientConnection.ssl(auth, ssl_ctx, host, port,
this, config) instead of HTTPClientConnection(auth, host, port,
this, config).
The none() default ensures all fields are initialized before the
constructor body runs, so this is ref when passed to
HTTPClientConnection.create() or HTTPClientConnection.ssl().
Implements¶
Public Behaviours¶
dispose¶
Public Functions¶
on_connected¶
Returns¶
- None val
on_connection_failure¶
Parameters¶
- reason: ConnectionFailureReason
Returns¶
- None val
on_response¶
Parameters¶
- response: Response val
Returns¶
- None val
on_body_chunk¶
Parameters¶
Returns¶
- None val
on_response_complete¶
Returns¶
- None val
on_parse_error¶
Parameters¶
- err: ParseError
Returns¶
- None val
on_closed¶
Returns¶
- None val
on_throttled¶
Returns¶
- None val
on_unthrottled¶
Returns¶
- None val
on_timer¶
Parameters¶
- token: TimerToken val
Returns¶
- None val