XMPP Connections

To use the XMPP API, it is necessary to have an XMPP connection. This can be done through Collecta's XMPP server, a third party XMPP server, or by speaking the XMPP server-to-server protocol directly.

If your application uses non-anonymous XMPP connections and does not support instant messaging, it is recommended that you set the connection's presence priority to negative one (-1) so that it does not inadvertently intercept messages intended for other connections for the same user.

Connection via Collecta's XMPP Server

Collecta provides an XMPP server that can be used to access the Collecta search API over XMPP. Anonymous access to this server is allowed, so users do not need any special accounts or credentials to make use of it. In addition, the server is tuned for high throughput data streams instead of normal instant messaging traffic.

To connect to the Collecta XMPP server, use the SASL ANONYMOUS authentication method with your XMPP library. The server will assign a random JID to the connection.

The following code is sufficient to make a connection to the Collecta server using the JavaScript XMPP library Strophe.

var conn = new Strophe.Connection(BOSH_URL);
conn.connect('guest.collecta.com', null, connect_callback);

Strophe will attempt a SASL ANONYMOUS connection when no user is specified in the JID.

You may also use Collecta's XMPP over HTTP gateway (BOSH) service. The BOSH endpoint is http://collecta.com/xmpp-httpbind.

Because of browser security policy, you will need to proxy this endpoint under your own domain or use something like flXHR to do the required cross-domain AJAX requests.

Connection via Third Party XMPP Servers

Any XMPP server that can communicate with other servers should be capable of allowing clients to utilize the Collecta search API. Most third party servers require credentials, and they are often tuned for instant messaging applications.

It is recommended that applications not use instant messaging based servers if their data transfer rates will be substantial. Many third party servers, including jabber.org and Google Talk, will impose rate limits on clients. These rate limits are often quite liberal for chat based use of the server, but tend to be fairly restrictive for data streaming.

If you have problems with search results stopping or being slow, please double check your application is not being rate limited.

Connection via Server-to-Server Protocol

Specialized applications may be written to impersonate servers by communicating directly with the Collecta API via the server-to-server XMPP protocol. This is the most efficient way to utilize the API, but also the most complicated.

< Home