Sunday, November 21, 2010

gen_client: running BOSH and new configuration options

As a result of efforts to make gen_client run over BOSH, there are now 2 new groups of options:

  • connection - allows to specify type of connection and its parameters. Available types are tcp, ssl and bosh. 
  • auth - allows to specify type of authentication and its parameters. There are currently 2 types reflecting exmpp authentication: basic (or legacy auth) and sasl. .
    Note: this version of gen_client will not work with exmpp versions lower than 0.9.5.

    Example: to login with through BOSH served at using SASL DIGEST-MD5:

    gen_client:start("", [{connection, {bosh, ""}}, {auth, [{password, "my_pwd"}, {sasl, "DIGEST-MD5"}]}]. 

    Yes, that's that simple. The default connection type is tcp, and default auth type is SASL PLAIN, so the code that uses previous versions of gen_client shouldn't break.

    Note: as of now (v. 0.9.5) exmpp supports only SASL PLAIN, SASL ANONYMOUS and SASL DIGEST-MD5. Also, BOSH will only work with SASL, but not with basic authentication.