Converse converse.js

Class: Connection

Connection()

The Connection class manages the connection to the XMPP server. It's agnostic concerning the underlying protocol (i.e. websocket, long-polling via BOSH or websocket inside a shared worker).

Constructor

new Connection()

Source:

Classes

Connection

Methods

(static) onConnected(reconnecting)

Called as soon as a new connection has been established, either by logging in or by attaching to an existing BOSH session.

Parameters:
Name Type Description
reconnecting Boolean

Whether Converse.js reconnected from an earlier dropped session.

Source:

(static) onConnected(reconnecting)

Called as soon as a new connection has been established, either by logging in or by attaching to an existing BOSH session.

Parameters:
Name Type Description
reconnecting Boolean

Whether Converse.js reconnected from an earlier dropped session.

Source:

(static) setDisconnectionCause(cause, reasonopt, overrideopt)

Used to keep track of why we got disconnected, so that we can decide on what the next appropriate action is (in onDisconnected)

Parameters:
Name Type Attributes Description
cause Number

The status number as received from Strophe.

reason String <optional>

An optional user-facing message as to why there was a disconnection.

override Boolean <optional>

An optional flag to replace any previous disconnection cause and reason.

Source:

(static) setDisconnectionCause(cause, reasonopt, overrideopt)

Used to keep track of why we got disconnected, so that we can decide on what the next appropriate action is (in onDisconnected)

Parameters:
Name Type Attributes Description
cause Number

The status number as received from Strophe.

reason String <optional>

An optional user-facing message as to why there was a disconnection.

override Boolean <optional>

An optional flag to replace any previous disconnection cause and reason.

Source:

onConnectStatusChanged(status, message)

Callback method called by Strophe as the Connection goes through various states while establishing or tearing down a connection.

Parameters:
Name Type Description
status Number
message String
Source:

onConnectStatusChanged(status, message)

Callback method called by Strophe as the Connection goes through various states while establishing or tearing down a connection.

Parameters:
Name Type Description
status Number
message String
Source:

(async) switchTransport()

Switch to a different transport if a service URL is available for it.

When reconnecting with a new transport, we call setUserJID so that a new resource is generated, to avoid multiple server-side sessions with the same resource.

We also call _proto._doDisconnect so that connection event handlers for the old transport are removed.

Source:

(async) switchTransport()

Switch to a different transport if a service URL is available for it.

When reconnecting with a new transport, we call setUserJID so that a new resource is generated, to avoid multiple server-side sessions with the same resource.

We also call _proto._doDisconnect so that connection event handlers for the old transport are removed.

Source:

Connection()

The Connection class manages the connection to the XMPP server. It's agnostic concerning the underlying protocol (i.e. websocket, long-polling via BOSH or websocket inside a shared worker).

Constructor

new Connection()

Source:

Classes

Connection

Methods

(static) onConnected(reconnecting)

Called as soon as a new connection has been established, either by logging in or by attaching to an existing BOSH session.

Parameters:
Name Type Description
reconnecting Boolean

Whether Converse.js reconnected from an earlier dropped session.

Source:

(static) onConnected(reconnecting)

Called as soon as a new connection has been established, either by logging in or by attaching to an existing BOSH session.

Parameters:
Name Type Description
reconnecting Boolean

Whether Converse.js reconnected from an earlier dropped session.

Source:

(static) setDisconnectionCause(cause, reasonopt, overrideopt)

Used to keep track of why we got disconnected, so that we can decide on what the next appropriate action is (in onDisconnected)

Parameters:
Name Type Attributes Description
cause Number

The status number as received from Strophe.

reason String <optional>

An optional user-facing message as to why there was a disconnection.

override Boolean <optional>

An optional flag to replace any previous disconnection cause and reason.

Source:

(static) setDisconnectionCause(cause, reasonopt, overrideopt)

Used to keep track of why we got disconnected, so that we can decide on what the next appropriate action is (in onDisconnected)

Parameters:
Name Type Attributes Description
cause Number

The status number as received from Strophe.

reason String <optional>

An optional user-facing message as to why there was a disconnection.

override Boolean <optional>

An optional flag to replace any previous disconnection cause and reason.

Source:

onConnectStatusChanged(status, message)

Callback method called by Strophe as the Connection goes through various states while establishing or tearing down a connection.

Parameters:
Name Type Description
status Number
message String
Source:

onConnectStatusChanged(status, message)

Callback method called by Strophe as the Connection goes through various states while establishing or tearing down a connection.

Parameters:
Name Type Description
status Number
message String
Source:

(async) switchTransport()

Switch to a different transport if a service URL is available for it.

When reconnecting with a new transport, we call setUserJID so that a new resource is generated, to avoid multiple server-side sessions with the same resource.

We also call _proto._doDisconnect so that connection event handlers for the old transport are removed.

Source:

(async) switchTransport()

Switch to a different transport if a service URL is available for it.

When reconnecting with a new transport, we call setUserJID so that a new resource is generated, to avoid multiple server-side sessions with the same resource.

We also call _proto._doDisconnect so that connection event handlers for the old transport are removed.

Source: