Skip to content

Documentation / @super-line/core / RawConn

Interface: RawConn ​

Defined in: packages/core/src/transport.ts:11

A live logical connection, from the core's point of view. Symmetric across server + client.

Properties ​

writable ​

readonly writable: boolean

Defined in: packages/core/src/transport.ts:15

Whether a send will be accepted now (WS derives this from readyState + bufferedAmount).

Methods ​

close() ​

close(code?, reason?): void

Defined in: packages/core/src/transport.ts:23

Graceful close (close handshake when the transport has one).

Parameters ​

code? ​

number

reason? ​

string

Returns ​

void


onClose() ​

onClose(cb): void

Defined in: packages/core/src/transport.ts:19

The logical connection died. code is best-effort (1000 graceful / 1006 abnormal when the transport has none).

Parameters ​

cb ​

(code, reason?) => void

Returns ​

void


onDrain() ​

onDrain(cb): void

Defined in: packages/core/src/transport.ts:21

The send buffer drained below the limit — safe to resume sending.

Parameters ​

cb ​

() => void

Returns ​

void


onMessage() ​

onMessage(cb): void

Defined in: packages/core/src/transport.ts:17

Register the handler for inbound frames. The transport MUST normalize each to a Uint8Array.

Parameters ​

cb ​

(bytes) => void

Returns ​

void


send() ​

send(bytes): void

Defined in: packages/core/src/transport.ts:13

Send already-encoded bytes. A no-op when not RawConn.writable.

Parameters ​

bytes ​

string | Uint8Array<ArrayBufferLike>

Returns ​

void


terminate() ​

terminate(): void

Defined in: packages/core/src/transport.ts:25

Hard close with no handshake — used by heartbeat reaping.

Returns ​

void

Released under the MIT License.