sip.js.transport.disconnect.md

September 26, 2022 ยท View on GitHub

Home > sip.js > Transport > disconnect

Transport.disconnect() method

Disconnect from network.

Signature:

disconnect(): Promise<void>;

Returns:

Promise<void>

Remarks

- If `state` is "Connecting", `state` MUST transition to "Disconnecting" before returning.
- If `state` is "Connected", `state` MUST transition to "Disconnecting" before returning.
- If `state` is "Disconnecting", `state` MUST NOT transition before returning.
- If `state` is "Disconnected", `state` MUST NOT transition before returning.
- The `state` MUST transition to "Disconnected" before resolving (assuming `state` is not already "Disconnected").
- The `state` MUST transition to "Connecting" or "Connected" before rejecting and MUST reject with an Error.

Resolves when the transport disconnects. Rejects if transport fails to disconnect. Rejects with StateTransitionError if a loop is detected. In particular, callbacks and emitters MUST NOT call this method synchronously.