GitHub

SocketService

API reference for SocketService.

A socket: acquiring reader in a scope opens it (until the scope closes); writer writes to the open connection, waiting for one. make(reader, writer) builds one.

Attributes

AttributeTypeDescription
readerEffect[Reader, SocketError, Scope]

Opens the connection for the life of the scope and gives its Reader, whose pull gives non-empty batches of incoming chunks and never ends: every close, a clean one included, fails it with a SocketError holding the reason, and so does closing the scope during a pull. Code between acquiring it and the first pull runs once per (re)connection. Fails with SocketError when the connection cannot be opened.

writerEffect[Writer, Never, Scope]

The Writer, detached from any one connection: acquiring it never fails, and writes made while disconnected wait for the next connection. Releasing its scope half-closes the write side where the transport can.

Functions

__init__

__init__(reader, writer) -> None
ParameterTypeDescription
readerEffect[Reader, SocketError, Scope]
writerEffect[Writer, Never, Scope]
def __init__(
    self, reader: Effect[Reader, SocketError, Scope], writer: Effect[Writer, Never, Scope]
) -> None:
    self._reader = reader
    self._writer = writer