EgretDoc
Back to Home
Location:system/aio.websocket

Module

Module documentation.

moduleaio.websocket

Classes

Classes and inheritance.

classaio.websocket::Conn
@brief`Conn` type.
@details`Conn` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Conn {
    /*
    @brief `fd` field.

Functions

Free functions and class methods.

functionaio.websocket::Conn.init
Signaturefunc init(self: aio.websocket.Conn, fd: Int = -1, tls_h: Int = 0, is_tls: Bool = false, timeout_ms: Int = 15000, read_buffer: String = "", mask_outgoing: Bool = false) -> Void
    func init(self: aio.websocket.Conn, fd: Int = -1, tls_h: Int = 0, is_tls: Bool = false, timeout_ms: Int = 15000, read_buffer: String = "", mask_outgoing: Bool = false) -> Void {
        self.fd = fd;
        self.tls_h = tls_h;
@briefInitializes a `Conn` instance.
@detailsEstablishes the initial field state for `Conn` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
  • fdOperating-system file descriptor or socket descriptor.
  • tls_hNative handle used to identify the tls handle resource.
  • is_tlsWhether the connection or protocol session uses TLS.
  • timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
  • read_bufferBuffer used to read, write, encode, or store intermediate data.
  • mask_outgoingWhether outgoing WebSocket frames must be masked.
@returnVoid
functionaio.websocket::Conn.deinit
Signaturefunc deinit(self: aio.websocket.Conn) -> Void
    func deinit(self: aio.websocket.Conn) -> Void {
        _ = self.close();
    }
@briefReleases fallback resources at the end of the `Conn` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionaio.websocket::Conn.close
Signaturefunc close(self: aio.websocket.Conn) -> ErrCode
    func close(self: aio.websocket.Conn) -> ErrCode {
        if self.closed {
            return std.OK;
@briefCloses resources and makes later operations unavailable with `Conn.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionaio.websocket::split_header_buffer
Signaturefunc split_header_buffer(conn: aio.websocket.Conn) -> String
func split_header_buffer(conn: aio.websocket.Conn) -> String {
    let sep: Int = protocol.websocket.header_end(conn.read_buffer);
    if sep < 0 {
@briefProvides the system library operation `split_header_buffer`.
@detailsExecutes the `split_header_buffer` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • connConnection object or native connection handle used for network I/O.
@returnReturns the operation result as `String`.

Variables

Class fields (var).

varaio.websocket::Conn.fd
TypeInt
@brief`fd` field.
@detailsStores the underlying file descriptor or socket descriptor. The field type is `Int`, and it is maintained by the constructors and methods of `Conn`.
    var fd: Int;
    /*
    @brief `tls_h` field.
varaio.websocket::Conn.tls_h
TypeInt
@brief`tls_h` field.
@detailsHolds the `tls_h` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var tls_h: Int;
    /*
    @brief `is_tls` field.
varaio.websocket::Conn.is_tls
TypeBool
@brief`is_tls` field.
@detailsHolds the `is_tls` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
    var is_tls: Bool;
    /*
    @brief `closed` field.
varaio.websocket::Conn.closed
TypeBool
@brief`closed` field.
@detailsIndicates whether the resource has already been closed. The field type is `Bool`, and it is maintained by the constructors and methods of `Conn`.
    var closed: Bool;
    /*
    @brief `mask_outgoing` field.
varaio.websocket::Conn.mask_outgoing
TypeBool
@brief`mask_outgoing` field.
@detailsHolds the `mask_outgoing` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
    var mask_outgoing: Bool;
    /*
    @brief `read_timeout_ms` field.
varaio.websocket::Conn.read_timeout_ms
TypeInt
@brief`read_timeout_ms` field.
@detailsHolds the `read_timeout_ms` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var read_timeout_ms: Int;
    /*
    @brief `write_timeout_ms` field.
varaio.websocket::Conn.write_timeout_ms
TypeInt
@brief`write_timeout_ms` field.
@detailsHolds the `write_timeout_ms` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var write_timeout_ms: Int;
    /*
    @brief `read_buffer` field.
varaio.websocket::Conn.read_buffer
TypeString
@brief`read_buffer` field.
@detailsHolds the `read_buffer` value for each `Conn` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
    var read_buffer: String;

    /*