Connect to XMPP over HTTP (BOSH/WebSocket) using Finesse EventTunnel
To initialize the XMPP connection, the following information must be passed to the EventTunnel before it can proceed:
-
Agent ID
-
XMPP Domain
-
Agent Password
-
XMPP PubSub Domain
-
Agent XMPP Resource (Optional)
The postMessage payload has the following message structure:
message = type + "|" + message;where type is a number that has the following mapping:
Message Type | Value | Description |
---|---|---|
EVENT | 0 | XMPP events received by the EventTunnel and published out to the parent frame |
ID | 1 | Agent XMPP ID |
PASSWORD | 2 | Agent XMPP password |
RESOURCEID | 3 | Agent XMPP resource |
STATUS | 4 | Status of the XMPP connection published by the EventTunnel |
XMPPDOMAIN | 5 | Domain of the XMPP service |
PUBSUBDOMAIN | 6 | PubSub domain of the XMPP service |
SUBSCRIBE | 7 | Request to subscribe to an XMPP node |
UNSUBSCRIBE | 8 | Request to unsubscribe form an XMPP node |
PRESENCE | 9 | Request to subscribe to XMPP presence |
DISCONNECT_REQ | 11 | Request to disconnect the XMPP connection. This request attempts to unsubscribe the application from all nodes to which it subscribed during the session and then disconnects the session. |
For example, a postMessage call to send the agent ID is as follows:
Be sure to also wire up a callback to receive messages using postMessage from the EventTunnel frame, for example:
where cb is the callback that handles any messages received using postMessage and that can parse the messages sent by the EventTunnel.