Message IDs should be sequential and compact

Here's a patch that generates message ids by incrementing a 32-bit unsigned integer, and base 36 encoding it on the way out to keep it compact.