Home > sip.js > Transport > onDisconnect
Callback on state transition from "Connected".
Signature:
onDisconnect: ((error?: Error) => void) | undefined;
When the UserAgent
is constructed, this property is set.
- The `state` MUST NOT "Connected" when called.
- If prior `state` is "Connecting" or "Connected", `error` MUST be defined.
- If prior `state` is "Disconnecting", `error` MUST NOT be undefined.
If the transition from "Connected" occurs because the transport user requested it by calling disconnect
, then error
will be undefined. Otherwise error
will be defined to provide an indication that the transport initiated the transition from "Connected" - for example, perhaps network connectivity was lost.