Skip to content

Instantly share code, notes, and snippets.

@remko
Created November 22, 2012 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remko/4131496 to your computer and use it in GitHub Desktop.
Save remko/4131496 to your computer and use it in GitHub Desktop.
Swiften: Connect over BOSH
#include <Swiften/Swiften.h>
using namespace Swift;
int main(int, char**) {
SimpleEventLoop eventLoop;
BoostNetworkFactories networkFactories(&eventLoop);
Client* client = new Client("me@server.lit", "mypassword", networkFactories); /* Substituting the JID and password accordingly. */
ClientOptions options;
options.boshURL = URL::fromString("http://server.lit/http-bind/"); /* Substituting the correct URL to the BOSH endpoint */
options.boshHTTPConnectProxyURL = URL::fromString("https://wwwproxy.server.lit:8080/"); /* Substituting the host/port for those of the proxy */
options.boshHTTPConnectProxyAuthID = "proxy username"; /* substituting the user name needed to authenticate with the proxy. Remove this line if the proxy doesn't require authentication */
options.boshHTTPConnectProxyAuthPassword = "proxy password"; /* substituting the user password needed to authenticate with the proxy. Remove this line if the proxy doesn't require authentication */
/* Insert here whatever handlers you want for receiving messages etc. - see http://swift.im/swiften/guide/ */
client->connect(options);
eventLoop.run();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment