Implement message writer.
Merge pull request #932 from square/jw/websocket-write

Implement message writer.