Interface: Connection
Defined in: netconf/src/transport/types.ts:13
A transport connection to a NETCONF server: the RFC 6241 §2.1 "persistent connection", with authentication and encryption already done.
A connection only moves bytes. Framing (transport/framing) sits on top of it, and the hello and everything above belong to the messages layer, so SSH, TLS, call home, an in-memory pair or a test harness all fit here.
The interface is the library's own rather than a Node.js stream, so it works in any JavaScript runtime: duplexConnection() adapts a Node stream to it, and connectionPair() makes two connected in-memory ends.
Properties
peer
readonly peer: ConnectionPeer;Defined in: netconf/src/transport/types.ts:15
Who we're talking to, for logs and errors.
Methods
close()
close(): Promise<void>;Defined in: netconf/src/transport/types.ts:30
Close the connection and anything underneath it (such as the SSH connection). Idempotent; never rejects.
Returns
Promise<void>
destroy()
destroy(): void;Defined in: netconf/src/transport/types.ts:28
Drop the connection at once, with no grace period. Idempotent.
Returns
void
end()
end(): void;Defined in: netconf/src/transport/types.ts:26
End our sending side. What the peer sends is still delivered until it closes. Idempotent.
Returns
void
receive()
receive(receiver): void;Defined in: netconf/src/transport/types.ts:22
Start receiving. Called once: a second receiver throws. Bytes that arrived before it are held and delivered to it, so none are lost. Nothing is delivered during the call itself, only afterwards, so the caller can finish setting up first.
Parameters
receiver
Returns
void
write()
write(bytes): void;Defined in: netconf/src/transport/types.ts:24
Send bytes. Sends nothing, and doesn't throw, once the connection has ended or closed.
Parameters
bytes
Uint8Array
Returns
void