refactor client.connect() arguments

fix client.connect() method to allow to pass additional headers (e.g. a
client-id header in issue #32).

The change is backwards compatible so that Web applications should not
have to change their call to work.