Fix bug and modify client initialize callback design

A callback function may be specified in the options passed to
the client class rather than using an additional argument

Bug was present due to improper use of this inside a try / catch
block making it difficult to find. Parsing the messages failed.