make messages api more flexible, use better formatting
added examples of long poll for the client
Updated docs, minor bugfixes