Fix encoding bug

* Binary messages were sent as text ones which may cause problems in the
server.
* Updated documentation