Transport #
This module exposes a Transport type class that is used to represent different transport mechanisms
that can be used with an HTTP connection.
Generic HTTP interface that abstracts over different transport mechanisms.
- recv : α → UInt64 → Async.Async (Option ByteArray)
Receive data from the client connection, up to the expected size. Returns None if the connection is closed or no data is available.
- sendAll : α → Array ByteArray → Async.Async Unit
Send all data through the client connection.
- recvSelector : α → UInt64 → Async.Selector (Option ByteArray)
Get a selector for receiving data asynchronously.
Close the transport connection. The default implementation is a no-op; override this for transports that require explicit teardown. For
Socket.Client, the runtime closes the file descriptor when the object is finalized.
Instances
Equations
- One or more equations did not get rendered due to their size.
Receives data from a channel, joining all available data up to the expected size. First does a
blocking recv, then greedily consumes available data with tryRecv until expect bytes are reached.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sends a single ByteArray through a channel.
Equations
- Std.Http.Internal.Mock.send sendChan data = do let __do_lift ← liftM (sendChan.send data) Std.Async.Async.ofAsyncTask (Task.map (Except.mapError (IO.userError ∘ toString)) __do_lift)
Instances For
Sends ByteArrays through a channel.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Creates a selector for receiving from a channel.
Equations
- Std.Http.Internal.Mock.recvSelector recvChan = recvChan.recvSelector
Instances For
Gets the receive channel for a client (server to client direction).
Equations
Instances For
Gets the send channel for a client (client to server direction).
Equations
Instances For
Sends a single ByteArray.
Equations
- client.send data = Std.Http.Internal.Mock.send client.getSendChan data
Instances For
Receives data, joining all available chunks.
Equations
- client.recv? expect = Std.Http.Internal.Mock.recvJoined client.getRecvChan expect
Instances For
Tries to receive data without blocking, joining all immediately available chunks.
Returns none if no data is available.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Closes the mock server and client.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gets the receive channel for a server (client to server direction).
Equations
Instances For
Gets the send channel for a server (server to client direction).
Equations
Instances For
Sends a single ByteArray.
Equations
- server.send data = Std.Http.Internal.Mock.send server.getSendChan data
Instances For
Receives data, joining all available chunks.
Equations
- server.recv? expect = Std.Http.Internal.Mock.recvJoined server.getRecvChan expect
Instances For
Tries to receive data without blocking, joining all immediately available chunks. Returns none if no
data is available.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Closes the mock server and client.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.