Skip to content

Interface: RpcContext ​

Defined in: netconf/src/messages/session.ts:185

The extension seam: everything an operation, extension or device profile may use. No connection, no framing, no session internals.

Extended by ​

Properties ​

logger ​

ts
readonly logger: Logger;

Defined in: netconf/src/messages/session.ts:197

The session's logger. Only enabled levels have a method, so call it as logger.debug?.(…).


serverCapabilities ​

ts
readonly serverCapabilities: CapabilitySet;

Defined in: netconf/src/messages/session.ts:193

The server's capabilities, after any corrections from the device profile.


sessionId ​

ts
readonly sessionId: number;

Defined in: netconf/src/messages/session.ts:195

The session-id the server assigned.

Methods ​

addRpcGuard() ​

ts
addRpcGuard(guard): () => void;

Defined in: netconf/src/messages/session.ts:207

Check every operation before rpc() sends it. A guard refuses by throwing; rpc() then rejects with that error and sends nothing. <close-session> from close() is never guarded. Returns a function that removes the guard.

Parameters ​

guard ​

RpcGuard

Returns ​

() => void


onClosed() ​

ts
onClosed(listener): () => void;

Defined in: netconf/src/messages/session.ts:201

Call listener once when the session closes. Returns a function that stops it.

Parameters ​

listener ​

(event) => void

Returns ​

() => void


onNotification() ​

ts
onNotification(listener): () => void;

Defined in: netconf/src/messages/session.ts:199

Call listener for every <notification> the session receives. Returns a function that stops it.

Parameters ​

listener ​

(notification) => void

Returns ​

() => void


rpc() ​

ts
rpc(operation, options?): Promise<RpcReply>;

Defined in: netconf/src/messages/session.ts:191

Send an operation (the content of <rpc>, as an element or XML text) and wait for its reply. Rejects with RpcError if the reply has an error-severity <rpc-error>.

Parameters ​

operation ​

string | XmlElement

options? ​

RpcOptions

Returns ​

Promise<RpcReply>

Released under the MIT Licence.